How do dogs find their way home?

It is thought that dogs have the ability to make a mental map of an area, they can survey the area by taking note of terrain, and using their sense of smell as well as hearing to build a mental map.

Some scientist think that dogs can sense the magnetic field and somehow use this to navigate.