Shakespeare's Twelfth Night, also known as What You Will, is a comedy which centres on mistaken identity.
In Illyria, Duke Orsino is sick with love with Lady Olivia, who is in mourning for her recently deceased father and brother. To honour their memory, she has sworn to live like a nun for seven years and refuses to receive any messages from Orsino.
Shipwreck and disguise
On the coast of Illyria, Viola and a ship's captain are washed ashore following a shipwreck in which Viola believes her twin brother, Sebastian, has died. For protection, she disguises herself as a young man (called Cesario) and gains employment in Orsino's household, where (s)he quickly becomes a favourite.
In Olivia's household, her peace is constantly disturbed by her drunken uncle, Sir Toby Belch and his friend, Sir Andrew Aguecheek, whom Toby has invited to stay in the hope that he can win Olivia's hand in marriage – and her fortune.
Despite falling in love with Orsino herself, the disguised Viola agrees to Orsino's request that she visits Olivia to plead on his behalf. On arrival, Cesario meets Olivia's clown, Feste. Once Cesario is admitted to Olivia's presence, 'his' persuasions on behalf of Orsino lead Olivia to fall in love with 'him' at first sight. Olivia sends Malvolio after Cesario to give her a ring, pretending Cesario left it behind. On receiving the ring, Cesario realises that Olivia loves her (in her disguise as a man) but decides the situation is too complex for her to untie.
Unknown to Viola, her brother, Sebastian, also survived the shipwreck in the company of Antonio, a sailor, and has also headed for Orsino's court, believing his sister to be dead. Antonio, for love, agrees to accompany him, even though he is a wanted man in Illyria.
At Olivia's court, Toby, Andrew and Feste are carousing late into the night, along with Olivia's maid, Maria, and resent being told by Malvolio to behave better. In retaliation, they plot to make a fool of him, convincing Olivia that he is mad, and leading to his being locked in a dungeon.
When Viola again visits Olivia on Orsino's behalf, Olivia declares her love for Cesario, making Aguecheek jealous. To win Olivia, he challenges Cesario to a duel, but both men are cowards and try to avoid the fight.
As they begin to duel Antonio arrives and, believing Cesario to be Sebastian, stops the fight but is recognised and arrested. Viola denies knowing Antonio, who is dragged away crying out the Sebastian has betrayed him. On hearing her brother's name, Viola has new hope that he may be alive.
Both Feste and Aguecheek mistake Sebastian for Cesario and Feste announces that Olivia desires to see him. A jealous Aguecheek strikes Sebastian, who retaliates. Sir Toby then duels with him until Olivia interrupts it.
Spoiler - stop here if you don't want to know how it ends
Olivia immediately begs Sebastian to marry her and, much to her surprise, he agrees and they head off to church.
As Olivia returns home, Orsino arrives with Cesario, begging to be admitted to her presence. Antonio arrives with the officers, describing how he saved Sebastian from drowning.
Olivia appears, calling Cesario her husband, shocking Viola and enraging Orsino. The priest confirms that he has married Cesario and Olivia, while Aguecheek and Sir Toby both accuse Cesario of injuring them, which Viola denies.
Sebastian then appears and he and Viola are delighted to discover that their twin is alive. Sebastian and Olivia are happy to be married, and Orsino immediately proposes marriage to Viola, who accepts.
The trick played on Malvolio is revealed and he is released from his prison, swearing revenge on them all. In gratitude to Maria for her help in fooling Malvolio, Sir Toby has married her and Aguecheek leaves for home poorer but no wiser.