Déjà vu is a rare occurrence, but you know it when you feel it. As you walk through a new city for the first time, something familiar clicks in your mind, giving you pause. You’ve definitely been here before.

But you haven’t. So what gives?

Well, no one really knows for sure. The origin of déjà vu (French for “already seen”), a sense of familiarity with something entirely new, remains hidden somewhere deep in our brains. The phenomenon is difficult to study—most people, when they experience déjà vu, aren’t hooked up to a bunch of electrodes, with clipboard-toting researchers at the ready.

However, scientists have pondered the question for quite some time: A description of a déjà vu experience in patients with epilepsy appears as early as 1888. The observation was no coincidence—those with some types of epilepsy seem to feel déjà vu more often than those without the neurological disorder. Research on such patients showed that their feelings of déjà vu were likely linked to seizure activity in the medial temporal lobe, the part of the brain associated with sensory perception, speech production and memory association.

During a seizure, neurons misfire, sending mixed-up messages to different parts of the body. For these patients, déjà vu is a result of getting their wires crossed. When some patients undergo brain surgery to stop the seizures, they wake up to a world free of the phenomenon.

Some scientists posit that similar neural misfiring—a glitch in the system—also causes healthy, seizure-free brains to experience a sense of familiarity when there’s no reason to.

A second hypothesis involves another brain error; this time, the problem is with our memory, says Anne Cleary, a cognitive psychology professor at Colorado State University. Something about a new situation or setting activates a memory of a similar past experience, but our brains fail to recall it. Cleary offers this scenario to help explain: Imagine you’re visiting Paris for the first time, and you have arrived at the Louvre. Your gaze lands on the giant glass pyramid jutting out of the museum’s main courtyard, and you get that strange feeling.

At that moment, your brain is failing to retrieve a memory that could explain it away: A few months ago, you watched The Da Vinci Code, a film that provides an up-close look at the Louvre Pyramid. “In the absence of recalling that specific experience,” Cleary says. “You’re left only with this feeling of familiarity with the current situation.”

Cleary suspected that this sense of familiarity results from our ability to remember the spatial configuration of surroundings. To test this hypothesis, she set out to induce déjà vu in a laboratory setting (PDF). Using the life simulation game The Sims, Cleary and her team built two scenes, different in their features but identical in their layout. The first was a courtyard setting featuring a potted tree in the center, encircled by various plants, and hanging plant baskets on the walls. The second was a museum setting that swapped the tree for a large statue, the floor plants with rugs and the hanging baskets with sconces.

When participants explored the second room, they reported experiencing a feeling of déjà vu, but they couldn’t connect that to their time spent navigating the first room. “People do have an increased sense of déjà vu when the scene has a similar layout, but they’re failing to recall the source of that familiarity,” Cleary says.

Yet another possible explanation for déjà vu, says Cleary, dates back to 1928, when psychology Edward Titchener described the sensation using the example of crossing a street. As we begin to cross a street, we instinctively look to the left, but if something catches our attention on our right, we turn in that direction. By the time we look to our left again, our brains may have forgotten the first glance. This second glance triggers a feeling of familiarity, because, in this case, we really have seen something before.

In many cases, people who experience déjà vu can’t pinpoint why it’s happening. But for what it’s worth, our brains are trying to tell us, Cleary says. Tip-of-the-tongue experiences work in much the same way: for instance, we know that we know the name of that actor in that one movie, but we can’t pull it to the front of our minds. “When retrieval does fail, our memories still have a way of alerting us to the fact that there’s something relevant in there,” she says. “There’s something there that maybe we want to keep searching for.”