There are a lot of reasons to try to do comedy in writing, or just in everyday life. Yes, comedy can be taught. This post is largely focused on writing it, but it should be fairly easy to distill into general advice.
The stakes in humor are usually low.
The difference between drama and comedy is exaggeration, and character reaction.
For example, the action scene gets funny fast when the guy gets kicked in the crotch.
It’s also funny when people get self-referential during uncomfortable situations.
Comedy is also often surprising; unexpected things are more likely to make people laugh. See Non-sequitors below.
Situational- out of their element and trying (and mostly failing) to cope.
Physical comedy- people doing ridiculous things. People even suffering. But really low stakes.
Wordplays: puns work best when the one who tells it isn’t the one who set it up.
Accurate but unexpected descriptions: the ships hung in the sky in much the same way that bricks don’t.
Awesome, especially when they can be tied to a particular character because they describe things in ways nobody else does.
Here’s a brief example of wordplay: if something is really easy to figure out, you’d probably say it’s obvious. But if it’s about someone’s mother or father, try goig with ‘apparent’.
Something about how the characters do things is inherently funny because of who they are.
This kind of contains and kind of leads into Running Gags, which is when one particular bit of character humor is repeatedly called back to.
You have three pieces of the puzzle, the fourth is the punchline, and the reader has to figure it out themselves.
Something that quite literally doesn’t follow in the expected sequence.
Often funniest when the reader can draw a connection between the non-sequitor and what came before, yet still doesn’t quite make sense.
Lists are great, when the last thing in the list is completely unexpected.