Twelfth Night is one of Shakespeare's most well-loved comedies, and stands as a classic example of the romantic comedy genre within the author's body of work, including the famous trope that he mastered: a young woman dresses as a boy to fool her peers and others.
In the play, Viola is introduced as the twin sister of a young man who is lost at sea; Viola herself survived the shipwreck. A sea captain tells her about Orsino, the Duke of Illyria who proclaims his love for the Lady Olivia. Viola wishes to serve the Lady Olivia who is mourning for her dead brother, as she identifies with her grief. But since this will prove difficult, the captain suggests Viola dress as a boy to serve the Duke Orsino instead. Once she meets the Duke, Viola (now known as the boy servant Cesario) falls in love with him, even as he continues to pursue his unrequited love for Olivia. Delivering the Duke's messages of love to Olivia, Viola discovers the lady is smitten with her in her disguise as the boy Cesario.
In most comedies the servants and other working or peasant class characters provide much comedy, and in this case a famous ruse involves Lady Olivia's house servant Maria and Lady Olivia's steward Malvolio. Maria thinks Malvolio is arrogant and annoying, and decides to play a trick on Malvolio by leaving him a note suggesting that Lady Olivia is in love with him, and describing the way he should dress and behave when next they meet.
We learn Viola's brother is alive when he comes to Illyria accompanied by Antonio, the man who saved his life. He is mistaken there for Cesario, since the two are twins and dressed in similar fashion. The Lady Olivia meets him and believes he is Cesario at first; Sebastian returns her affections. The two secretly marry, which leads to all manner of confusion when Viola/Cesario is later mistaken for Sebastian. Eventually the siblings are reunited after discovering they both survived the shipwreck and arrived in Illyria in similar ways. Orsino agrees to take Viola as his wife (once her identity is revealed) and it is suggested they will marry soon.