Comedy is defiance. It's a snort of contempt in the face of fear and anxiety. And it's the laughter that allows hope to creep back on the inhale.
Imagination was given to man to compensate him for what he is not, and a sense of humor was provided to console him for what he is.
Analyzing humor is like dissecting a frog. Few people are interested, and the frog dies of it.