From the father-son reveal in The Empire Strikes Back to the shocking realization at the end of The Sixth Sense, everyone loves a good plot twist. It's not the element of surprise that makes them so enjoyable, though. It's largely the set-up, according to cognitive scientist Vera Tobin.
Tobin, a researcher at Case Western Reserve University, writes for The Conversation that one of the most enjoyable moments of a film or novel comes after the big reveal, when we get to go back and look at the clues we may have missed. "The most satisfying surprises get their power from giving us a fresh, better way of making sense of the material that came before," Tobin writes. "This is another opportunity for stories to turn the curse of knowledge to their advantage."
The curse of knowledge, Tobin explains, refers to a psychological effect in which knowledge affects our perception and "trips us up in a lot of ways." For instance, a puzzle always seems easier than it really is after we've learned how to solve it, and once we know which team won a baseball game, we tend to overestimate how likely that particular outcome was.
Good writers know this intuitively and use it to their advantage to craft narratives that will make audiences want to review key points of the story. The end of The Sixth Sense, for example, replays earlier scenes of the movie to clue viewers in to the fact that Bruce Willis's character has been dead the whole time—a fact which seems all too obvious in hindsight, thanks to the curse of knowledge.
Christopher Nolan leaves us hanging with the spinning top Totum in inception to make us wonder how much of the plot has been played out in the 3 stage dream reality we'd seen play out in the film and how much in Leo's character's brain. Is it open ended, left to the viewer, or can it be figured out? See this end of Inception explanation for clarity.
This is also why writers often incorporate red herrings—or false clues—into their works. In light of this evidence, movie spoilers don't seem so terrible after all. According to one study, even when the plot twist is known in advance, viewers still experience suspense. Indeed, several studies have shown that spoilers can even enhance enjoyment because they improve "fluency," or a viewer's ability to process and understand the story. A good example of this is the plot twist in Martin Scorsese's Shutter Island ending. Second time around, even now we know Leo's character is roleplaying as a form of therapy in a mental institution, we now have the benefit of how it plays out second time around with the new knowledge in mind.
Still, spoilers are pretty universally hated— the Russo brothers even distributed fake drafts of Avengers: Infinity War to prevent key plot points from being leaked—so it's probably best not to go shouting the end of this summer's big blockbuster before your friends have seen it.