The plot against Malvolio is explained for the audience by Maria in Act II scene 3, after Malvolio has broken up the party of Sir Toby Belch, Sir Andrew and Maria. It consists of these characters getting their own back against Malvolio by Maria leaving a letter for Malvolio to find that she has written, impersonating the hand of her mistress, the Lady Olivia. In it, Maria will write as if she were Olivia, using the kind of phrases that she uses, and confess her love for Malvolio. This is because Malvolio is a character who, above all else, is obsessed with seriousness and sobriety. This plot will hopefully make him ridiculous and cause him to act completely out of character.
The plot succeeded because it recognises and works with the weaknesses of its victim. Maria says in Act II scene 3 that the plot will work because she "knows her physic well." She knows her art but she also knows Malvolio and his own, vain, foolish pride. The fact that he enters Act II scene 5 imagining what life would be like if her were married to Olivia suggests that he had already contemplated or dreamed about rising up the ranks of society through marrying Olivia, even coming up with another example to support such a case of a noblewoman marrying beneath her:
There is example for't: the Lady of the Strachey married the yeoman of the wardrobe.
The plot works so well therefore precisely because it works with suspicions and foolish ideas that Malvolio already has. It plays with his puffed up sense of pride and importance and works with his own weaknesses to make him truly absurd.