I recently found this animation which shows the motion of sun as observed from mercury. It seems as if the sun stops in between, retraces a bit and then continues towards the west. What is the reason for this strange motion? Is it because of variation in the distance between mercury and the sun? Or is it because a day on Mercury is longer than Mercury's year?
Both effects combined.
Day being longer than year would just have retrograde motion of the Sun on sky, but no direction change.
Variation of the distance alone happens on Earth, and we have no such effect.
But the combination of both factors, in the precise amount they have on Mercury, makes this effect happen.