It's the trigger that releases the surprise. If your humor falls flat, do what professional humorists do. Pretend you are serious. Since the listeners didn't realize you were making a joke, you never need to apologize or explain it. Turn your surprise into a secret.
Laughter is a pressure valve which releases muscle tension.
Uncomfortable situations, fear and pain are all tension builders that cry out for humor. We find ourselves laughing at risqu humor and embarrassing situations because they make us uncomfortable. We release the tension they create with humor. People who intentionally and frequently use humor know tension can be used deliberately to heighten the impact of the humor. A pause placed just before the punch line or the punch word builds a sense of anticipation, a form of tension, which makes the joke stronger.