I really like a good twist ending, which may be surprise some people since I'm kind of a know-it-all. But I love 'em! They can have a huge impact on an audience binding them all together so as not to spoil the secret to anyone who hasn't seen the film. A good surprise ending is preceded by a story that posits the narrative direction in another way. Usually it is a character's perception that is changed, they are illuminated in some way which brings about the surprise or twist ending. Because the audience follows a singular character's journey (which is not uncommon in most narrative films) we are in their head space. We believe what they believe. We have our audience horse-blinders on.
"I see dead people"
One of the most common tropes of a twist ending is that a character has been dead all along (like Sixth Sense, The Others or Carnival of Souls) is something I find particularly interesting. Our notion of death in the Western hemisphere is one of finality. Even if we have religious beliefs they are that our souls ascends (or descends in come cases) into another plane of existence. We are no more in this world. The "Dead Protagonist" trope extends the notion of life, after our hearts stop beating we still have a presence. In some ways it is oddly comforting. Upon our first viewing we may find such a reveal frightening because we have for the past 90 or so minutes with someone who is dead. Could we be dead? Why did we pay to see a movie if we're dead? But upon repeat viewings, if the film is well made, we can pick up on clues that illuminate the twist and in turn, we see that life might not simply just end. We are still a part of this world. In The Sixth Sense (1999), it is Malcolm's (Bruce Willis) realization that he is dead that ends the narrative. He accepts his death that we saw early in the film and is able to say goodbye to his wife.
"This house is ours, this house is ours."
In The Others (2001) it is Nicole Kidman and her children who are our protagonists and dead. Confined to a creepy house the titular "others" are the new owners and the thrust of the film is Kidman & Co. scaring them away without realizing it. Released within two years of each other, The Others is often criticized as riffing on The Sixth Sense's final shock. (if you want to play the semantics game An Occurrence at Owl Creek Bridge is even older) But what The Others does differently is it puts the ghosts in control. In the Sixth Sense Malcolm is a narrative tool, but the plot lives and dies with the deceased in The Others. Had the new living owners never entered the house, we would have no narrative, it never would have begun.
"You dream too much about water in this house."
Another common trope is an inversion of the plan. For me, the touchstone in this is always Cluzot's Diabolique (1955) (or Les Diabolique if you're feelin' fancy). The plot is a simple one; the wife and mistress of a cruel school master plot to murder him... I feel like a dick for even typing that last sentence since the movie does close with this: Don't be devils. Don't ruin the interest your friends could take in this movie. Don't tell them what you saw. So will not say any more. Diabolique investigates the explosion of chaos. The boarding school where the film takes place is wound tighter than a monkey in a pinata, it's primed for an uprising and once the two women agree on a plan the controlled tension of the symbolic underclass in the school becomes palpable throughout the whole film. Once the two women agree on a plot the film remains a thriller but one based in emotions that begin to run high and once the emotions are unleashed it is a question of containment. The ending is an emotional one, one born from intense feelings and one that incorporates all the imagery that has come before it. It is not a narrative tragedy, but a moral one. It is unexpected (well, maybe not by today's standards) but once you see it, it seems there is no other way it could have ended.
"Muffy hasn't been in an institution for three years, she's been at Vassar!"
Then, of course, there are the surprises which read as a "fuck you" to the audience like April Fool's Day (1986). I happen to really like April Fool's Day, it's so goofy. A bunch of young people go up to a stately and remote house only to be terrorized by a killer who is the host's identical twin sister who escaped from a mental institution. The Final Girl fights till the end only to discover... it was all a joke. The host doesn't have an identical twin sister but has organized the whole thing as a test run for some kind of horror resort she wants to open. There isn't a whole lot of analysis for this one, except that it plays on our coded expectations of slashers. April Fool's Day openly mocks the conceit that the entire weekend is fictionalized. Every story we see or tell is fictionalized in some way. April Fool's Day comes right out and tells us is it.