Humor in fiction is awesome, completely underrated, and a universal way to connect with readers. You need it in your bag of tricks, writers.
Maybe a person can’t learn to be quick-witted, or have a cache of one-liners at the ready, but writers have something on their sides: time. It’s like when you think of something funny that you could have said to that guy that one time in the cereal aisle three weeks ago? It’s too late now for that zinger about shredded wheat, but that same kind of brooding is great for your manuscript! You can type out a 100% unfunny draft and then go back in and weave humor in as needed over time as you revise and things come to you. Readers don’t know when you came up with it. And if you take yourself out of the equation and just focus on aspects of the story being humorous, it takes the pressure off and can loosen your inhibitions.
Don’t tell me that you are not a funny person. You’re not a teenage boy/mermaid/drummer living in a castle/abandoned amusement park/parallel dimension, but you’re managing to make that work in your story, right?
There are different theories about why people think something is funny, but we know that a few are probably pretty true to human nature.
Superiority/Humans are Jerks Theory: People feel amused when they feel superior over others (Hobbes).
Incongruity/Wait…what? Theory: People laugh when what happens doesn’t match their expectations (Aristotle).
Relief/Inappropriate Laughers Motto Theory: Things are funnier when we need to reduce tension (Freud).
Look at examples from books that you find funny and work backwards to consider why they might have struck your funny bone. Humor requires communication, truth, and especially empathy. Empathy isn't just about sadness and pity, it's a person’s ability to understand and share another’s feelings and be able to imagine themselves in that position. We need our readers to be empathetic to our characters to connect with the story, or the story doesn't work. And humor and empathy go together like chickens and eggs. Plus, the more characters in the situation that a reader can empathize with, the funnier a scene can be. The best novels strike a balance between drama and humor, because life is like that. It rings true. If you know a person that is always goofing off and can never take anything seriously, or a person who never cracks a smile, never appreciates the wit or irony of a situation, is always morose— you probably won’t have a solid connection with either of them, and the same holds true with novels.
Think of a universal truth in your manuscript and find a way to convey it with comedy. Humor is a perfect tool to get you to show the story instead of telling the story. You can do it via the premise, setting, interaction, expectations, obstacles/antagonism/challenges, quirks, situations, foreshadowing, etc. If you can think it up, you can probably make it funny. Here are a few examples (with mild spoilers):
A CROOKED KIND OF PERFECT by Linda Urban
Premise: Girl really wants a piano, but her dad buys her an organ.
(Truth: Sometimes we have to endure the actions of others.)
THE TRUE MEANING OF SMEKDAY by Adam Rex
Characterization: Protagonist’s mom names her something that doesn’t mean what she thought it did, so she goes by a funny nickname.
(Truth: Caregivers don’t always make wise decisions.)
TALES OF A FOURTH GRADE NOTHING by Judy Blume
Challenge/antagonism: Fudge eats Peter’s pet turtle.
(Truth: Younger siblings can be hazardous to a peaceful existence.)
THE FAULT IN OUR STARS by John Green
Dialogue: Isaac allows Augustus to make puns about his cancer and they laugh about it.
(Truth: Close friends can make light of things that others may not.)
OKAY FOR NOW by Gary Schmidt
Situation: Doug drinks a coke from Lil too quickly and the foam comes out of his nose.
(Truth: We sometimes have the least grace in front of people we'd rather impress.)
Each of these are a means for the author to show the reader more about that aspect of the story by using humor, rather than telling them what they are using the humor to convey.
And a caveat for our particular audience: Kids use humor as an indirect way of coming to terms with issues and situations that are most important to them, and/or too emotionally stressful for them to deal with directly. If the overall feel of a story is dramatic, humor can instill some amusement into an otherwise serious tone. Sometimes the saddest stories can also be the funniest (see THE FAULT IN OUR STARS above). That’s where Freud’s release of tension comes into play. There’s a reason that it is called comic relief.
The plot arc of a story is, in a way, a problem. You don’t want to resolve things too soon, so pace it out with some wit. Start with dialogue. Dialogue is one of the easiest ways to convey a wide variety of humorous possibilities— sarcasm, banter, Freudian slips, exaggeration, understatement, naivety, confusion, insults… they are all tools you can use in a funny exchange between characters. Use them selectively, but do use them. What can you show by how your character uses humor? Do they know that they’re funny? When don’t they joke? How do others react?
Use humor as a tool and you’ll have a stronger story. We need more funny books! Try thinking of someone specific with a great sense of humor, and write for them. Or try writing a scene that conveys your protagonist’s trait or mannerism in a comedic way. Recollect a funny and/or embarrassing scene from your childhood, and embellish it. Do it for a laugh. And if you're amused, your readers probably will be, too.
You can see an (incomplete) list of books that have great examples of humor here. Let me know what I missed!