From Scientific American:
As a dung beetle rolls its planet of poop along the ground it periodically stops, climbs onto the ball and does a little dance. Why? It's probably getting its bearings. A series of experiments published in the January 18 issue of PLoS ONE shows that the beetles are much more likely to perform their dance when they wander off course or encounter an obstacle. Until now, no one had any idea what a jitterbugging dung beetle was up to. Emily Baird of Lund University in Sweden and her colleagues study how animals with tiny brains—such as bees and beetles—perform complex mental tasks, like navigating the world. The dung beetle intrigues Baird because it manages to roll its dung ball in a perfectly straight line, even though it pushes the ball with its back legs, its head pointed at the ground in the opposite direction. If the six-legged Sisyphus can't see where it's going, how does it stay on its course?
Every now and then, a dung beetle stops rolling, mounts its ball and pirouettes. Baird noticed that dung beetles do not dance as often in the lab, where they roll around on flat surfaces, as they do in the field, where the terrain is rough and rocks and clumps of grass often obstruct the beetles' paths. She guessed that by climbing onto a ball of dung four or five times its height, a beetle gets a pretty good vantage point from which to correct any navigational mistakes.