A plot twist is a literary technique that introduces a radical change in the direction or expected outcome of the plot in a work of fiction.  When it happens near the end of a story, it is known as a twist or surprise ending.  It may change the audience's perception of the preceding events, or introduce a new conflict that places it in a different context. A plot twist may be foreshadowed, to prepare the audience to accept it. There are a variety of methods used to execute a plot twist, such as withholding information from the audience or misleading it with ambiguous or false information.
Revealing a plot twist to readers or viewers in advance is commonly regarded as a " spoiler", since the effectiveness of a plot twist usually relies on the audience's not having expected it. Even revealing the fact that a work contains plot twists – especially at the ending – can also be controversial, as it changes the audience's expectations. However, at least one study suggests that this does not affect the enjoyment of a work. 
An early example of the romance genre  with multiple twists  was the Arabian Nights tale " The Three Apples". It begins with a fisherman discovering a locked chest. The first twist occurs when the chest is broken open and a dead body is found inside. The initial search for the murderer fails, and a twist occurs when two men appear, separately claiming to be the murderer. A complex chain of events finally reveals the murderer to be the investigator's own slave.
This section needs additional citations for verification. (September 2014) ( Learn how and when to remove this template message)
Literary analysts have identified several common categories of plot twists, based on how they are executed.
Anagnorisis, or discovery, is the protagonist's sudden recognition of his or her own or another character's true identity or nature.  Through this technique, previously unforeseen character information is revealed. A notable example of anagnorisis occurs in Oedipus Rex: Oedipus kills his father and marries his mother in ignorance, learning the truth only toward the climax of the play.  The earliest use of this device as a twist ending in a murder mystery was in " The Three Apples", a medieval Arabian Nights tale, where the protagonist Ja'far ibn Yahya discovers by chance a key item towards the end of the story that reveals the culprit behind the murder to have been his own slave all along.  
In the 1980 film The Empire Strikes Back, a sequel to 1977's Star Wars, the climax of the story is the revelation that the villain Darth Vader is the biological father of protagonist Luke Skywalker. In M. Night Shyamalan's 1999 film The Sixth Sense, a main character, who struggles with his failure to help a former patient who shot him, resolves his conflict by helping a boy who believes he communicates with dead people, only to discover that he did not survive the shooting and is one of the dead people being helped. In the 2001 film The Others, a mother is convinced that her house is being haunted; at the end of the film, she learns that she and her children are really the ghosts. In the episode of The Twilight Zone titled " Five Characters in Search of an Exit", the viewer discovers at the climax that the characters are discarded toys in a donation bin. In Fight Club, Edward Norton's character realizes that Tyler Durden ( Brad Pitt) is his own multiple personality. A mental patient in the horror film The Ward reveals that the three persons she is talking to are all actually herself. In the 2011 film Shutter Island, the main character, a detective investigating a murder in a mental hospital, discovers he is actually a patient himself, tricked by the doctors to regain his true memories, lost after the trauma that brought him into the hospital in the first place. Sometimes the audience may discover that the true identity of a character is, in fact, unknown, as in Layer Cake or the eponymous assassins in V for Vendetta and The Day of the Jackal.
Flashback, or analepsis, a sudden, vivid reversion to a past event,  surprises the reader with previously unknown information that solves a mystery, places a character in a different light, or reveals the reason for a previously inexplicable action. The Alfred Hitchcock film Marnie employed this type of surprise ending. Sometimes this is combined with the above category, as the flashback may reveal the true identity of one of the characters, or that the protagonist is related to one of the villain's past victims, as Sergio Leone did with Charles Bronson's character in Once Upon a Time in the West or Frederick Forsyth's The Odessa File.
A cliffhanger or cliffhanger ending, is a plot device in fiction which features a main character in a precarious or difficult dilemma or confronted with a shocking revelation at the end of an episode of serialized fiction. A cliffhanger is hoped to incentivize the audience to return to see how the characters resolve the dilemma.
An unreliable narrator twists the ending by revealing, almost always at the end of the narrative, that the narrator has manipulated or fabricated the preceding story, thus forcing the reader to question his or her prior assumptions about the text.  This motif is often used within noir fiction and films, notably in the film The Usual Suspects. An unreliable narrator motif was employed by Agatha Christie in The Murder of Roger Ackroyd, a novel that generated much controversy due to critics' contention that it was unfair to trick the reader in such a manipulative manner.  Another example of unreliable narration is a character who has been revealed to be insane and thus causes the audience to question the previous narrative; notable examples of this are in the Terry Gilliam film Brazil, Chuck Palahniuk's Fight Club (and David Fincher's film adaptation), Gene Wolfe's novel Book of the New Sun, the second episode of Alfred Hitchcock Presents, Premonition, the 1920 German silent horror film The Cabinet of Dr. Caligari, Iain Pears's An Instance of the Fingerpost, Shutter Island and Kim Newman's Life's Lottery.
Peripeteia is a sudden reversal of the protagonist's fortune, whether for good or ill, that emerges naturally from the character's circumstances.  Unlike the deus ex machina device, peripeteia must be logical within the frame of the story. An example of a reversal for ill would be Agamemnon's sudden murder at the hands of his wife Clytemnestra in Aeschylus' The Oresteia or the inescapable situation Kate Hudson's character finds herself in at the end of The Skeleton Key. This type of ending was a common twist ending utilised by The Twilight Zone, most effectively in the episode " Time Enough at Last" where Burgess Meredith's character is robbed of all his hope by a simple but devastating accident with his eyeglasses. A positive reversal of fortune would be Nicholas Van Orton's suicide attempt after mistakenly believing himself to have accidentally killed his brother, only to land safely in the midst of his own birthday party, in the film The Game.
Deus ex machina is a Latin term meaning "god from the machine." It refers to an unexpected, artificial or improbable character, device or event introduced suddenly in a work of fiction to resolve a situation or untangle a plot.  In Ancient Greek theater, the "deus ex machina" ('ἀπὸ μηχανῆς θεός') was the character of a Greek god literally brought onto the stage via a crane (μηχανῆς—mechanes), after which a seemingly insoluble problem is brought to a satisfactory resolution by the god's will. The term is now used pejoratively for any improbable or unexpected contrivance by which an author resolves the complications of the plot in a play or novel, and which has not been convincingly prepared for in the preceding action; the discovery of a lost will was a favorite resort of Victorian novelists. 
A red herring is a false clue intended to lead investigators toward an incorrect solution.  This device usually appears in detective novels and mystery fiction. The red herring is a type of misdirection, a device intended to distract the protagonist, and by extension the reader, away from the correct answer or from the site of pertinent clues or action. The Indian murder mystery film Gupt: The Hidden Truth cast many veteran actors who had usually played villainous roles in previous Indian films as red herrings in this film to deceive the audience into suspecting them. In the bestselling novel The Da Vinci Code, the misdeeds of a key character named "Bishop Aringarosa" draw attention away from the true master villain ("Aringarosa" literally translates as "pink herring"). In the William Diehl novel Primal Fear (also adapted into a film), a defendant named Aaron Stampler is accused of brutally murdering the Archbishop of Chicago. He is revealed to have a dissociative identity disorder, and is not executed on plea of insanity. Near the end, Aaron's lawyer discovers that he feigned his insanity to avoid the death penalty. Agatha Christie's classic And Then There Were None is another famous example and includes the term as well in a murder ploy where the intended victims are made to guess that one of them will be killed through an act of treachery. The complete second timeline of the sixth season of the television series Lost is a red herring. Until the end it seems like a way that could happen, but in fact it takes place after they were all dead. A red herring can also be used as a form of false foreshadowing.
A false protagonist is a character presented at the start of the story as the main character, but then disposed of, usually killed. An example is the film Executive Decision, in which the special-forces team leader, played by highly-billed action star Steven Seagal, is killed shortly after the mission begins. Another instance is Psycho's Marion Crane (portrayed by Janet Leigh), who is brutally murdered early in the film. A contemporary example is the character of Casey Becker (played by then A-list actress Drew Barrymore) in Scream, who is killed in the first fifteen minutes.
A non-linear narrative works by revealing plot and character in non-chronological order.  This technique requires the reader to attempt to piece together the timeline in order to fully understand the story. A twist ending can occur as the result of information that is held until the climax and which places characters or events in a different perspective. Some of the earliest known uses of non-linear story telling occur in The Odyssey, a work that is largely told in flashback via the narrator Odysseus. The Aeneid, another epic poem, uses a similar approach; it begins with the main protagonist, Aeneas, telling stories about the end of the Trojan War and the first half of his journey to Dido, queen of Carthage. The nonlinear approach has been used in works such as the films Mulholland Drive, Sin City, Premonition, Arrival, Pulp Fiction, Memento, Babel, the television shows Lost, How I Met Your Mother (especially in many episodes in the later seasons), Heroes, Westworld and the book Catch-22.  
Reverse chronology works by revealing the plot in reverse order, i.e., from final event to initial event.  Unlike chronological storylines, which progress through causes before reaching a final effect, reverse chronological storylines reveal the final effect before tracing the causes leading up to it; therefore, the initial cause represents a "twist ending". Examples employing this technique include the films Irréversible, Memento, Happy End and 5x2, the play Betrayal by Harold Pinter, and Martin Amis' Time's Arrow. Stephen Sondheim and George Furth's Merrily We Roll Along and the 1934 Kaufman and Hart play that inspired it both tell the story of the main characters in reverse order.
- Ralph Stuart Singleton; James A. Conrad; Janna Wong Healy (1 August 2000). Filmmaker's dictionary. Lone Eagle Pub. Co. p. 229. ISBN 978-1-58065-022-9. Retrieved 27 July 2013.
- Judith Kay; Rosemary Gelshenen (26 February 2001). Discovering Fiction Student's Book 2: A Reader of American Short Stories. Cambridge University Press. p. 65. ISBN 978-0-521-00351-3. Retrieved 27 July 2013.
- Jonah Lehrer, Spoilers Don’t Spoil Anything, Wired Science Blogs
- Marzolph, Ulrich (2006). The Arabian Nights Reader. Wayne State University Press. pp. 240–2. ISBN 0-8143-3259-5.
- Pinault, David (1992). Story-Telling Techniques in the Arabian Nights. Brill Publishers. pp. 93, 95, 97. ISBN 90-04-09530-6.
- Chris Baldick (2008). The Oxford Dictionary of Literary Terms. Oxford University Press. p. 12. ISBN 978-0-19-920827-2. Retrieved 23 July 2013.
- John MacFarlane, "Aristotle's Definition of Anagnorisis." American Journal of Philology - Volume 121, Number 3 (Whole Number 483), Fall 2000, pp. 367-383.
- Pinault, David (1992). Story-Telling Techniques in the Arabian Nights. Brill Publishers. pp. 95–6. ISBN 90-04-09530-6.
- Marzolph, Ulrich (2006). The Arabian Nights Reader. Wayne State University Press. pp. 241–2. ISBN 0-8143-3259-5.
- Chris Baldick (2008). The Oxford Dictionary of Literary Terms. Oxford University Press. p. 13. ISBN 978-0-19-920827-2. Retrieved 23 July 2013.
- Chris Baldick (2008). The Oxford Dictionary of Literary Terms. Oxford University Press. p. 347. ISBN 978-0-19-920827-2. Retrieved 23 July 2013.
- "The ubiquitous unreliable narrator". My.en.com. 1996-03-26. Archived from the original on 2001-12-24. Retrieved 2012-12-10.
- Michael Payne; Jessica Rae Barbera (31 March 2010). A Dictionary of Cultural and Critical Theory. John Wiley & Sons. p. 689. ISBN 978-1-4443-2346-7. Retrieved 23 July 2013.
- Joseph Twadell Shipley (1964). Dictionary of World Literature: Criticism, Forms, Techniques. Taylor & Francis. p. 156. GGKEY:GL0NUL09LL7. Retrieved 23 July 2013.
- Baldick, Chris (2004), The Concise Oxford Dictionary of Literary Terms, Oxford: Oxford University Press, ISBN 978-0-19-860883-7
- Linus Asong (2012). Detective Fiction and the African Scene: From the Whodunit? to the Whydunit?. African Books Collective. p. 31. ISBN 978-9956-727-02-5. Retrieved 23 July 2013.
- Josef Steiff (2011). Sherlock Holmes and Philosophy: The Footprints of a Gigantic Mind. Open Court. p. 96. ISBN 978-0-8126-9731-5. Retrieved 23 July 2013.
- Adrienne Redd, Nonlinear films and the anticausality of Mulholland Dr., Prose Toad Literary Blog
- "Plots Inc. Productions". Plotsinc.com. Archived from the original on 2017-10-12. Retrieved 2012-12-10.
- John Edward Philips (2006). Writing African History. University Rochester Press. p. 507. ISBN 978-1-58046-256-3. Retrieved 23 July 2013.