It really depends on the writer. I have some favorites (Terry Pratchett, Lois McMaster Bujold) who have me howling with laughter for half the story, and other favorites (Ursula LeGuin, China Mieville) who might make me crack one quiet smile in a book. It’s a style question, not a content question, and everyone’s style will vary. Sometimes, style isn't even something you have conscious control over. My first novel was a dark, gritty cyberpunk with a genetically-engineered super-assassin MC* and all my beta readers told me “hey, this book is really funny.” I didn’t take it well at first, but I have come to accept my fate.
As far as humor in a narrative goes, as with everything else, it’s all about what you want to do. Laughter is a natural defense we deploy in the face of surprise, a way of controlling cognitive dissonance before it overwhelms us. This can work for you, as a writer, or against you. There’s a climatic moment in the Firefly movie that I’ve seen Whedon characterize smugly in interviews as increasing the seriousness by showing people “anyone can die”, investing them in the stakes, and make them hang breathlessly on the last scenes of the movie. But in the theatre I was in, the whole audience erupted in laughter. And they
kept laughing and cracking jokes for the rest of the movie, tittering through all the high-tension, high-stakes scenes. The moment was
so surprising, so out of left field, that it broke immersion and ruined not only that moment but all the moments after — a remarkable banana peel for someone who made the phrase “sudden but inevitable” famous to step on.
So laughter can be a sign you’ve screwed up, that you haven’t foreshadowed something well enough to make it believable. But it can also be used to make the story
more real. One of my favorite Pratchett moments is a scene at the end of
Going Postal. We’re given
just enough information to realize the hero has pulled off a last-minute reversal and against all odds, may have won — and then before telling us
how he pulled it off, Pratchett spends a few paragraphs on the wizards who are using this climactic moment as an excuse to hit the buffet before the crowds of less serious eaters can get there:
The Lecturer in Recent Runes ladled more bacon bits into his salad bowl, having artfully constructed buttresses of celery and breastworks of cabbage to increase its depth five times.
“Any of you fellows know what this is all about?” he said, raising his voice above the din.
I am not so bold timing-wise as Pratchett, but a reminder that not everyone in your story sees the hero’s goals as paramount or even particularly noteworthy is one of the easiest ways to add depth and believability to a story, and humor is one of the most subtle and concise ways to achieve it. In this case humor doesn’t break the tension, it increases it. That the wizards consider dinner more important than the plot is surprising but, well... inevitable.
I think it’s also worth noting that there’s a difference between
character humor and
narrative humor that people often trip over. Jokes characters tell each other may or may not be funny to the reader, because being funny to the reader isn’t their purpose; their purpose is to establish a character as the kind of person who cracks jokes, and other characters as the kind who find that joke funny (or don’t). Conversely, what makes readers laugh the most are things a character says or does quite seriously — they’re funny because they’re out of tune with the narrative, not because anyone was telling a “joke”.
So a comic relief character is someone who takes themselves seriously, but that the narrative constantly encourages readers to laugh at. Sometimes -- if the character is absurd because of the power they hold, for example, or because they're selfish and petty, or both -- it can work. But it's inherently cruel, and often, it says more about who the writer thinks it's OK to bully than the writer would like. Think for a minute about *cringe* JarJar Binks. He wasn't a petty character with petty goals; he wanted to save his people. So why was he "funny"? Because he was clumsy, because he talked in broken English, because he was a backwoods hick. It's
okay to laugh at
those kind of people, they deserve it. Ever notice how often Hollywood comic relief is a black man or a fat woman?
Yeah. "Funny", isn't it.
Laughter is powerful, and like all powerful things, it's dangerous. But used well, it's an amazing tool for making worlds and characters come alive.
*
I was twenty, okay.