Comedy writing is a never ending process of hit and miss. Real laughter is an involuntary action. Even when we shouldn’t, we can’t help ourselves. Comedy is full of contradictions. One of the roles as you write comedy, is to deflate human pomposity.
The main source of comedy is divergent thinking. Comedy takes all the wrong things seriously and vise versa. It makes connections where there obviously aren’t any and fails to see obvious connections.
This origin of comedy is tied to the rule of three. The first incident draws the general direction, the second incident confirms it, the third incident is already expected before it happens. You lead your reader through misdirection and switch on them in the last moment. Surprise! The readers should not be able to tell that something is going to be funny. Don’t announce the joke, just let it happen.
Observation and recognition (familiarity)
Recognition, sometimes referred to as familiarity in this context, comes from common experiences that we don’t often deal with in an open honest way. Through observation, you can see these experiences and pointing them out and makes it universal, which is funny.
Embarrassment & Social taboo
When we suddenly realize that revolting personal habit we thought was ours alone, turns out to be common or noticed. Laughter is a natural response to embarrassing situations and social taboos.
Truth can be very effective but sometimes the crazy or terrible pun are prone to generate laughter too. Even when the reader is sober. It is the contradiction of ideas, the lack of logic of it, that makes it funny. This is often taken to extremes.
Words can have a figurative meaning, a literal meaning and multiple meanings. You can use the literal meaning of a figurative phrase to point out how ridiculous it sounds. Alternatively you can make good use of multiple meanings by using suggestive connotation, this allows you to be rude without being rude. In example, the word “sausage”.
An exaggeration is taking what is normal and blowing it out of proportion. Events occur to which the characters will react beyond all proportion: the mountain out of a molehill syndrome.
Character Traits / Stereotypes
The character is either likeable or the butt of the joke. A character can be likeable while being an arrogant jerk, when he regularly makes a fool of himself. You can hold a person’s negative traits up for ridicule.
Sources: Willis, C. Learning to Write Comedy
Evans, D. The Seven Laws of Comedy Writing