Snakes are brilliant - at being snakes. And they can definitely remember things that are relevant to them.
I have a terrarium on top of a desk. One time the snake went missing for weeks, and I finally found it on the floor of in my bedroom closet - inside a comic book box. The closet is consistently the darkest, quietest area of my apartment so it made sense he'd like being in it.
To get there, it had to:
climb down from the desk
travel along 2 walls of the living room - behind the tv stand, in front of bookcases, past balcony door, under part of sofa
go through a small opening in the wall for the radiator pipe
travel along 2 walls of the bedroom
into the closet and into a hiding spot.
That's quite a long and complicated route, there are obstructions along the way the snake had to get around, over, and through. But he really likes that dark and quiet closet. As a test, I allowed him to escape one night and kept watching, and he got back to the closet faster than I was expecting. Now, I can put him down pretty much anywhere in the apartment, leave the PVC cage door open, and he will find his way back there and get into the warm hide pretty quickly. And when I blocked access to the hole in the wall, he figured out an alternate route to the closet! So I bought a PVC cage and put it on the floor of the closet, as a 'second home' for him for when I'm cleaning the glass terrarium, or have people over and there's going to be a lot of noise/activity in the living room.
And it's a safety device because if he does manage to escape his terrarium or otherwise goes missing, odds are very good I'll find him in his second home.