How does deception lead to misery, while enlightenment relieves suffering in Twelfth Night?
Since Twelfth Night is a comedy, there is only one instance of true misery and that is the wicked joke played upon Malvolio. This much debated joke or prank ties into one of the thematic concerns of the play: vanity that may inspire malevolence.
Olivia is consumed by vanity that leads her to mourn endlessly for her deceased brother and scorn Orsino. Orsino is consumed with vanity that leads him to endlessly opportune Olivia to be his wife and disregard her wishes. Both are "sick of self-love," to borrow Olivia's words describing Malvolio. Malvolio suffers from his own outrageous vanity that makes him "sick of self-love" and truly inspires malevolence in others.
It is this sickness of vanity in Malvolio that leads Sir Andrew, Fabian, Maria, and Sir Toby to "gull" him--or fool him--in Act IV, scene ii. Malvolio knows real misery, which is inflicted through animosity from Sir Toby and Sir Andrew and as revenge from Fabian, who resents Malvolio because he caused Fabian to fall out of favor in Olivia's estimation:
I would exult, man: you know, he brought me out o'
favour with my lady about a bear-baiting here.
The deception these perpetrate against Malvolio leads to the misery of his humiliation and his imprisonment, for which Olivia promises punishment will be delivered: "Thou [Malvolio] shalt be both the plaintiff and the judge / Of thine own cause."
Conversely, enlightenment relieves suffering once Sebastian's survival is revealed and Viola's disguised identity is revealed. Prior to this enlightenment, Antonio believes Sebastian has betrayed him: "That most ingrateful boy there by your side." Olivia believes Cesario has forsaken her: "Ay me, detested! how am I beguiled!" Yet suffering is relieved when all are enlightened. Not only that, but the principal players have cause for rejoicing after enlightenment.