How to Get Humor Right
Humor is a necessary ingredient. We need humor to both to sustain us and allow us to cope. Otherwise, life would be nothing but moments of tension strung together. How great does that sound? In everyday life, humor can come naturally without much effort on our part. The world can be funny all on its own. But to write humor effectively, we have to know exactly what humor is, how, and when to use it. So what exactly is humor? Is it a dad joke? Is it slipping on a banana peel? Is it spending hours to pick out a perfect suit or dress for a party, only to show up and realize that it is a costume party? The answer is yes. Humor is wordplay. Humor is physical comedy. Humor is an unexpected outcome. So which one do you choose? Part of it depends on what you're writing.
There is a misconception that you need to be writing comedy to write humor. But in reality, humor can, and in my opinion, needs to exist at some level in all genres for balance and variety. For example, horror stories need humor in order to relieve tension. Readers can't sustain rising tension throughout the entire length of a novel. It's emotionally exhausting. They need breaks. However, this doesn't mean throw in a joke just as your main character is being stabbed. A poorly timed bit of humor negatively affects the pacing and tension of your story.
The best way to place humor is just before or just after discreet bits of tension. Don't think of it as a dip in tension, but more like a plateau. You know how stairwells have the bit of platform between floors where you can catch your breath? It's exactly like that. The stairwells still go up, but there are places to pause and recover.
Furthermore, adding humor to horror widens the emotional journey that the reader will experience. Instead of beginning at neutral and dropping down to horrified, they can begin at neutral, rise to humored, then drop down to horrified, amping up both emotions.
It's also very important to make sure your humor comes from the right source. Maybe you've placed the humor at the right point in your story, but does it come from the appropriate character, setting, or circumstance? Does it make sense that a certain character makes a certain joke? Does it ring true with their personality? Do someone's pants fall down for any reason that serves the story, other than to be funny?
If you're worried about this, try taking the joke that you're thinking of inserting and allow a different character to say it in their voice, with their personality. Keep doing this with all of your characters. Does it feel better with one than another? If so, maybe save it for that character.
So unless your chosen genre or story is specifically humor, don't feel like you have to shoehorn it in any ol' where. Allow humor to be a spice that punctuates the dish in the right amount, in the right way and you'll have tastier, juicier stories in no time.