Malvolio should probably be the starting point for any exploration of madness within the play. The sub-plot of the play and the 'letter trick' are designed by Toby and Maria to make Olivia think Malvolio is mad: prancing around, blowing kisses, in his yellow stockings, it seems a good diagnosis. 'This is very midsummer madness', Olivia says in the scene.
Yet Malvolio is NOT mad - but in love with Olivia. Olivia says herself in a later scene 'I am as mad as he [Malvolio] if sad and merry madness equal be'. Olivia, of course, in love with 'Cesario' (actually a girl, Viola, in disguise) is, like Malvolio, fooled into falling in love, which explains her hugely unusual behaviour towards Cesario, who is, after all, only a servant.
Look too at what Feste says when reading the letter to Olivia in the final scene: his crazed delivery of the text is not madness itslef, but just reading madness. That is, Feste only speaks the words that a supposed madman has written down - but does that (could that?) make you mad? Is an actor mad just for speaking the lines of a mad character?
Few people would argue that, but it makes the point that Twelfth Night dwells on: that madness is threaded through every day life, and boundly close up with 'sane' behaviour. Perhaps, as Romeo says in Romeo and Juliet, it is love which is 'a madness most discreet' in 'Twelfth Night'.
No one is truly insane in Twelfth Night, yet a number of characters are accused of being mad, and a current of insanity or zaniness runs through the action of the play. After Sir Toby and Maria dupe Malvolio into believing that Olivia loves him, Malvolio behaves so bizarrely that he is assumed to be mad and is locked away in a dark room. Malvolio himself knows that he is sane, and he accuses everyone around him of being mad. Meanwhile, when Antonio encounters Viola (disguised as Cesario), he mistakes her for Sebastian, and his angry insistence that she recognize him leads people to assume that he is mad. All of these incidents feed into the general atmosphere of the play, in which normal life is thrown topsy-turvy, and everyone must confront a reality that is somehow fractured.