Well im sure the planet has to be at a certain position, but im not sure how they calculate it. if you want to find out best looking for probes sent to that planet then look at what degree they are relative to earth, use a simulation like NASAS EYES and look to see when it happens again. Im sure there's a way to find out somewhere on the internet what is a lot easier though.