Interesting and true:
Everything human is pathetic. The secret source of humor itself is not joy but sorrow. There is no humor in heaven.
~Mark Twain
Okay, so let me clarify because the quote sounds wildly depressing. (I believe) what Twain meant was this: true humour is the pain of humanity wrapped in a truth, and delivered in a way that twists the mind to the unexpected.
The joke sets the œpain, the punch line gives us the truth, and the pairing of both, is what is funny.
For example:
An old man goes to the wizard to ask if he can remove a curse he’s been living with for the last 40 years. The wizard says, “Maybe, but you’ll have to tell me the exact words that were used to put the curse on you.” The old man says without hesitation, “I now pronounce you man and wife.”
Pain: A man finds the woman he fell in love with is not the same as the woman he married.
Truth: Marriage sometimes feels like a curse.
So, that’s what he meant(to paraphrase John Vorhaus): It’s the human experience, the shared humiliations, joys, and unexpectedness of life. It’s the garbage pain, the startling truth, the weird lunacy that bonds us, makes us laugh, and gives us the punchline.