As M. Night Shyamalan returns to cinemas with Trap, we explore what twist endings can achieve.

Warning: contains spoilers for…well, loads of stuff.

Twist endings have always been a bit of a double-edged sword.

Bruce Willis and Haley Joel Osment in The Sixth Sense

Take a look atM.

So what makes a twist ending good or bad?

What is the difference between being tricked and loving it, and being tricked and hating it?

In short, what is a twist endingfor?

The planet of the apes, you see, was Earth all along!

This is no longer a story of space exploration, but one of post-apocalyptic survival.

The protagonist was dead the whole time!

The same is true ofFight Club.

Sometimes this is to the point where the original story is completely destroyed.

It doesnt just change your perspective.

To Reveal Audience Bias

Stop me if youve heard this one before.

A father and son are in a car accident and are both badly hurt.

Ambulances arrive and for some reason take both patients to different hospitals.

The boy needs surgery to survive and is wheeled into the operating theatre.

But before the surgeon can begin operating they say I cant operate on this patient.

How is this possible?

Because the surgeon was hismum!

Did you see that coming?

Because they can do that!

Then the person who does help him is, get this, aSamaritan!

AgoodSamaritan, if you’re able to imagine such a thing!

Okay, so maybe these stories dont land with modern audiences quite the way they once did.

By confounding your expectations, it illustrates what those expectations are.

Take our detective story version of Cinderella.

ConsiderDoctor Whoseries 14 episode Dot and Bubble.

Because Lindy and her mates are white supremacists and the Doctor is Black.

Thatending proved to be divisive.

All the information you needed to guess the Dot and Bubble twist is there.

But most of all the episode makes no secret of the fact that everyone on this planet is white.

A huge part of the first act of the episode is just row upon row of white faces.

Not that Davies isnt above leading us to look the other way.

Which again, is why twists like this can provoke anger.

Trapis in cinemas now in the US and arrives in the UK on Friday August 9.