Madness is the explanation for just about any silly, curious, or crazy behavior in theAlice books. The reader must give in and accept a certain degree of irrationality in order to enjoy the tales. Madness is not simply the opposite of sanity; there are many degrees and types of madness, each of which deviates from the norm in a different way and to a different extent. Madness has no negative connotation; on the contrary, it seems freeing and interesting. However, madness in these books is different from foolishness, which evokes pity and compassion.
Although the Cheshire Cat claims that all the characters in Wonderland are mad, they're actually relatively reasonable – they just have different underlying assumptions about how the world works.
In the Alice books, "madness" is just another term used to describe things that are fantastic or imaginative.