Insanity refers to being afflicted by a mental disorder or severe mental illness. Madness is an older term for the same concept. It can be used metaphorically to refer to the extreme stupidity or unworkability of ideas without necessarily implying that the proposer suffers literally from insanity. For example, "the insanity of liberal tax-and-spend proposals."
The term insanity is no longer in use in the medical community, though it is still in formal use in American law in referring to one who cannot be found guilty of a crime even though he actually committed the action. The metaphorical use is also in frequent colloquial use, e.g. "Insanity is doing the same thing over and over and expecting a different result."