Just HOW do dogs do it? Move 20 miles away to a strange place and then manage (HOW) to find your old home and family.
People stink more than they know.
Years ago, when my husband and I were first married, after spending the night at my parent’s home, my husband let the dog out but could not find him when it was time to leave for work. Knowing he would show up soon, we told my parents to keep him and we would come back for him that afternoon. When my husband got off from work, he went to our home first. Without getting out of the truck, he stopped at the mail box and went to the barn to feed the calves. He sat in the truck to look through the mail and saw movement out the corner of his eye. There was our dog jumping up and down to get his attention. We called my parents to tell them he was home. Mom could not believe he had traveled over 10 miles, but he had.
When I was about 10 we had a super smart standard poodle. Full grown. Someone had given him to us after they found him. We had him for about 6 months with no fenced yard and he was a wanderer and killed one of grandma’s chickens. Oops! he had to go. Gave him to a nice family we knew in a town about 40 miles away in the mountains. About 2 months later I was in the front yard and looked down the road and here came Cocoa. He looked pretty bad but had found his way back to our house. We called the people and they came to get him again and I guess kept a close watch on him for awhile because he never came back.
We used to have hounds, many times they were running coyotes, and were driven in a truck 20 miles from home while hunting with some friends. If we couldn’t catch them, they would normally be home the next afternoon.
We also had a border collie that we took to my grandfather’s house, put a doghouse for her to help keep coons out of the garden. His house was about 12 miles, when we finished our farm work for the day and got home, she was sitting on the porch.