Decades ago, family friends lost their collie when she disappeared from their yard.
She appeared home something like a year later - in bad shape (thin, paws bleeding etc.).
All they could guess was that she’d been stolen (she had unusual coloring and I guess was somewhat valuable) and finally escaped and found her way home.
Less dramatic: I once had a cat disappear for 24 hours. Finally I heard her meowing plaintively outdoors. She was on the roof of a neighboring apartment building. Apparently she’d run up a tree nearby, and leapt from a branch to the roof of the building. I wound up knocking on the door of a stranger’s second-floor apartment, going onto her balcony, standing on a chair, and coaxing the cat to the edge of the roof with the aid of some chicken guts helpfully provided by the lady in the apartment.