In reply to robert-hutton:
My dog knows - because it recognises landmarks (I assume) when it goes to places it knows are fun, such as sand dunes with rabbits! When we went to see our daughter (and their dog) our dog used to get so excited we'd letter run the last mile or so even though we may not have been for several months.
Out walking my dog can recognise individual gates, gaps in hedges, rocks and particular footpath junctions and will change directions, following the route last used over a year previously.
Some years ago I took her to my mother's house for the first time. We only used the front entrance which was a part of a long stretch of terraced houses. My dog loved my mum as mum thought our dog was starving and fed her treats accordingly.. The following day I took our dog out of the front door and went for a run. Several hundred yards later my dog vanished from my side. She'd never been this way, nor walked the footpaths before, yet I found her patiently sitting at the back door of mum's house. She'd managed to navigate her way across new features and directly to the rear entrance to the house which she'd never used before.
I don't think the previous owner of the sheep dog in question would bother return it anonymously - Why?