Astronomers call this retrograde motion and it is down to our changing viewpoint from Earth rather than the planets literally changing direction.
Mars has the largest retrograde motion. Since Mars is further from the Sun than our planet, it orbits the Sun slower, meaning Earth on the inside track can catch it up and then overtake it. As Earth passes Mars, our view of the Red Planet changes relative to the more distant constellations and it therefore appears to move backwards. It isn’t really, it is just an illusion caused by Mars being slower. As Earth moves around the Sun the motion of Mars appears to change and it begins to move forward again. If we could draw a line following its path, it would appear to loop.
Got a question for us? Send it into email@example.com and you could see it featured in All About Space – available every month for just £3.99. Alternatively you can subscribe here for a fraction of the price!