One of us hides our eyes and then slowly reveals them. This causes peals of laughter from a baby, which causes us to laugh in turn. Then we do it again. And again.

Peekaboo never gets old. Not only does my own infant daughter seem happy to do it for hours, but when I was young I played it with my mum ("you chuckled a lot!" she confirms by text message) and so on back through the generations. We are all born with unique personalities, in unique situations and with unique genes. So why is it that babies across the world are constantly rediscovering peekaboo for themselves?

Babies don't read books, and they don't know that many people, so the surprising durability and cultural universality of peekaboo is perhaps a clue that it taps into something fundamental in their minds. No mere habit or fashion, the game can help show us the foundations on which adult human thought is built.

An early theory of why babies enjoy peekaboo is that they are surprised when things come back after being out of sight. This may not sound like a good basis for laughs to you or I, with our adult brains, but to appreciate the joke you have to realise that for a baby, nothing is given. They are born into a buzzing confusion, and gradually have to learn to make sense of what is happening around them. You know that when you hear my voice, I'm usually not far behind, or that when a ball rolls behind a sofa it still exists, but think for a moment how you came by this certainty.

The Swiss developmental psychologist Jean Piaget called this principle 'object permanence' and suggested that babies spent the first two years of their lives working it out. And of course those two years are prime peekaboo time. Looked at this way, the game isn't just a joke, but helps babies test and re-test a fundamental principle of existence: that things stick around even when you can't see them.

Maybe evolution fixed it so that babies enjoy peekaboo for its own sake, since it proved useful in cognitive development, but I doubt it. Something deeper than mere education is going on.

Surprise element

Peekaboo uses the fundamental structure of all good jokes - surprise, balanced with expectation. Researchers Gerrod Parrott and Henry Gleitman showed this in tests involving a group of six-, seven- and eight-month-olds which sound like more fun than a psychology experiment should be. Most of the time the peekaboo game proceeded normally, however on occasion the adult hid and reappeared as a different adult, or hid and reappeared in a different location. Videos of the infants were rated by independent observers for how much the babies smiled and laughed.

On these “trick trials” the babies smiled and laughed less, even though the outcome was more surprising. What's more, the difference between their enjoyment of normal peekaboo and trick-peekaboo increased with age (with the eight-month-olds enjoying the trick trials least). The researchers' interpretation for this is that the game relies on being able to predict the outcome. As the babies get older their prediction gets stronger, so the discrepancy with what actually happens gets larger - they find it less and less funny.

The final secret to the enduring popularity of peekaboo is that it isn't actually a single game. As the baby gets older their carer lets the game adapt to the babies' new abilities, allowing both adult and infant to enjoy a similar game but done in different ways. The earliest version of peekaboo is simple looming, where the carer announces they are coming with their voice before bringing their face into close focus for the baby. As the baby gets older they can enjoy the adult hiding and reappearing, but after a year or so they can graduate to take control by hiding and reappearing themselves.

In this way peekaboo can keep giving, allowing a perfect balance of what a developing baby knows about the world, what they are able to control and what they are still surprised by. Thankfully we adults enjoy their laughter so much that the repetition does nothing to stop us enjoying endless rounds of the game ourselves.

If you would like to comment on this article or anything else you have seen on Future, head over to our Facebook or Google+ page, or message us on Twitter.