A primary theme of Twelfth Night is one twin being mistaken for another. This is a recurring theme in the play in the forms of similarities between pairs of events, situations, or characters, the equating of something with its opposite, and the propensity for things to happen exactly twice.
The first, most obvious pair is of Viola and Sebastian, the fraternal twins so similar in appearance they are mistaken for each other. Not only their outward appearances are similar, they also appear in similar situations. We first see Viola in 1.2 lamenting her brothers death to the sea captain who saved her from drowning. When Sebastian enters in 2.1 he is lamenting Viola's death to a sea captain who saved him from drowning. While Viola was playing Cesario as a part of Orsino's court, Sebastian was pretending to be a Roderigo (2.1 14-16) while staying with Antonio.
In 3.4, Viola finds herself forced into a fight with Sir Andrew. First Viola and Andrew draw, then Antonio, mistaking Viola for Sebastian, prepares to enter the fray on Viola's side, which draws Toby in on Andrew's side. The brawl is averted by the entrance of some officers. Antonio, being arrested, becomes angry with Viola when she claims not to know him. (Lines 310-350) In 4.1, Sir Andrew, mistaking him for Viola, strikes Sebastian, who fights back, and is left ready to fight Sir Toby when Olivia enters to prevent it. When Olivia mistakes Sebastian for Viola, though, she invites him to come with her to her house.
In 2.2 when Malvolio bring Viola a ring from Olivia, Viola is hesitant to accept it. In 4.3, Sebastian is thrilled to have received a pearl from Olivia.
The parallel between Viola and Sebastian extends to parallels between the characters surrounding them. Viola and Sebastian are both saved from drowning by sea captains. Both are initially accompanied into the city by their respective captains. When Antonio is arrest for a past crime in 3.4, it begins what is probably the strangest, and most inexplicable, pairing of the play, for in 5.1 (lines 274-277) we learn that Viola's captain has also been arrested. Antonio is arrested for a suit from Orsino, while Viola's captain is arrested at a suit from Malvolio, who in his role here parallels Orsino as the man of Olivia's household.
Orsino and Olivia are to some degree a pair. They are the heads of the two relevant households in the play, both noble, both unmarried. Olivia is infatuated with Viola, while Viola is falling in love with Orsino. The parallel is strongest at the end, where the situation is left that Orsino will marry Viola and Olivia Sebastian.
Olivia, of course, is in a very similar situation to Viola, her brother having recently died. In 1.2 lines 35-45 or so, Viola suggests that this shared pain is the reason she wants to meet Olivia.
There are also scenes that parallel each other although they do not necessarily reflect any parallel between the characters involved. Orsino asks for music in 1.1 and again in 2.4. Feste sings for Toby and Andrew in 2.3, and for Orsino in 2.4. In 2.4, Orsino asks Feste for "the song we had last night" (Line 42), recalling the immediately preceding scene strongly enough that the audience may forget that Feste was singing for different people in a different place then. On the first of these occasions, Feste is paid twice for singing, by Toby and by Andrew (2.3 Lines 30-33). In 3.1, lines 43-53, Feste is paid twice by Viola. In 5.1, lines 25-37, Orsino pays Feste twice but refuses to pay three times.
Olivia sends Malvolio with a ring for Viola in 2.2, Olivia presents her with a locket in person in 3.4 (Line 210). Orsino sends Viola with a jewel to Olivia in 2.4 (Line 123). In 4.3, Olivia gives a pearl to Sebastian.
Malvolio chastises Sir Toby in 2.3 for Olivia; in 2.5, in his fantasy, he chastises Sir Toby as master of the house. Malvolio is locked away because of behavior brought about by a letter; in 5.1, his own letter helps to free him (start line 281).
There is also a great deal of word play showing twins or pairs. Maria signs the letter "the fortunate unhappy" (2.5 156). The place names Illyria and Elysium sound similar enough to suggest the idea that Illyria may perhaps be heaven. Feste feels that his foes are of more help to him than his friends (4.3 line 10). Feste says a drunken man (like Sir Toby) is like a drowned man (which Sebastian is believed to be), a fool (as Feste is), and a madman (as Malvolio will be presumed to be) (1.5 lines 127-128). Maria describes Feste as a "dry fool" (1.5 line 38). Malvolio describes him as a "barren rascal" (1.5 line 81). In 1.3, lines 72-78, Maria describes herself as "dry" and "barren". Feste's verbal sparing with Olivia in 1.5, lines 61-71, inverts the usual wish to be alive, and inverts the usual assumption that the dead are in heaven, confusing heaven and hell. The argument, of course, is over whether Olivia is really the fool. Feste continues this speaking in opposites during his role as Sir Topas the curate in 4.2.
The mention in 5.1, line 364, that Sir Toby has married Maria, caps off the absurd plot, where plausibility is seemingly much less important than making sure its intertwined as tightly as possible.