Warning: the following post contains complete spoilers for The Nun!
Going into a prequel movie like The Nun can be tricky. After all, we already know how it should end: the demon Valak, better and more ominously known as The Nun, will have to emerge victorious if it's going to eventually move on to haunt Lorraine Warren (Vera Farmiga) in The Conjuring 2. The characters of Father Burke (Demián Bichir) and Sister Irene (Taissa Farmiga) are doomed from the start. Without giving too much away (before I dive into a post ripe with spoilers, teehee), I was pleasantly surprised by the way the creative powers that be handled the story. If you're curious about how they managed to pull off their twist, I'm outlining the entire ending below. This is your last chance to turn back!
OK, so you basically know the gist of the story: Father Burke and Sister Irene go to some remote part of Romania to investigate the suicide of a nun. Once they arrive, they meet the man who discovered the body: a laborer who calls himself "Frenchie." From there, it's a pretty quick turnaround to get them up to the haunted convent, and all hell breaks loose shortly thereafter. Their first night kicks off with scares: Father Burke gets buried alive, while Sister Irene gets terrorized by the demon.
The next day, Burke reads a bunch of books, trying to identify the nature of the demon they're dealing with, while Irene interviews the surviving nuns of the convent. She learns that some crazy duke once opened a gate to Hell on these grounds, and they must pray constantly to keep the evil at bay. Burke learns that the demon is called Valak, and it means business. Cue nightfall.
After a particularly scary sequence, Burke rescues Irene in the chapel, and she realises all the nuns she's been talking to are long dead, mere specters or visions that are trying to help her solve the mystery. Also, Frenchie inexplicably shows up again at the convent to help them defeat evil. Irene realises the gate to Hell, which they must close, is in the catacombs. The basement also contains a very important artifact, which they need to seal the gate: the blood of Christ, contained in a glass vial.
The three find the vial and of course get separated in the bowels of the convent. Valak sets sights on a human host to inhabit: Irene. Frenchie and Burke attempt to throw themselves at Valak to save the day, but they are quickly cast aside. All seems lost. Valak holds Irene down in a shallow pool of water until she drowns. This is the ending we expected, right? You'd think it's the moment when Valak wins and possesses Irene's body as the life drains out of her, then goes off into the world. But that's not what happens!
It turns out Irene has put the blood of Christ in her mouth (ew?), and once Valak pulls her out of the water, she spits the blood right in Valak's face. Valak recoils, horrified and burning from the blood, and the water all drains out of the room and into the gaping hole on the floor; it's the original gate to Hell that they've been trying to close all along. Once Valak goes back to the depths of the darkness, the gate closes shut. It's a surprising end that leaves the viewer a bit perplexed, because Valak was supposed to win.
In the aftermath of the terrible ordeal, the trio prepare to leave the convent for good. Irene asks Frenchie — he reveals his name is actually Maurice — if he'll stick around, but he says he's had enough of Romania. Suddenly, in a closeup on his neck, we see a small protrusion: it's an upside-down cross, meaning Valak has actually possessed Maurice and not Irene. In a flashback, we're led to assume that Valak jumped into Maurice right after strangling him and just before the whole water encounter.
The stinger at the end shows how Valak finally makes contact with Lorraine Warren: the demon eventually consumes Maurice completely, and Ed and Lorraine are on hand to assist in the exorcism. The rest is history.