I use to ponder that question a lot and it wasn't until I got older did I figure it out. (I'm 55 now)
It's something you're born with, simple as that.
I've done a lot of misc work for people and I once worked for a lawyer who was so freaking book smart and his memory was amazing. He remembers everything he reads and he understands things like those word problems that were actually math problems.
He asked me to do some work in his office and gave me his keys. Then he said "when you're done slide the keys under the door" and I said "Oh so you have a second set of keys?" he then paused and said... "I'll just get those keys from you later."
It's just hilarious he was always saying stuff like that, He had almost no common sense at all but probably the smartest guy I've met personally. Anyway I was bored and hopped up on coffee hope you don't mind the long winded reply. Have a great day!