Does humor always spring from surprise?
It seems like a lot of humor has an element of surprise. Sudden meanings, unexpected turns of the plot, language unexpected given the context (impolite language in polite context, technical in a non-technical context, etc). I find it hard to think of a joke or other humorous text where there is not an element of surprise, discovery of a hidden meaning, unexpected juxtaposition or subverted expectation.
Is it really the case that humor must involve surprise, or is it just a coincidence?
Some simple (maybe not particularly good funny) examples to illustrate:
This classic knock-knock joke (NSFW language) - like many knock-knock jokes, the audience is delighted to hear that instead of a humorous quip, the punchline is just an unfriendly put down - whereas joking is usually a friendly act. Profanity is also out of character for Agent Hanratty's professional and polite demeanor. Lastly, the set up promises a traditional joke at the expense of some fictional character, but ends up being anti-humor at the audience's expense.
"Two penguins walk into a bar, which is stupid because the second should have seen it." - two layers of humor. One because the audience assumes "bar" refers to the establishment which is a common setting for "bar jokes". Second because the humor is expected to come from a wild animal attempting to patronize a human establishment, whereas in fact it comes from their misfortune and inability to learn from their mistakes.
The famous quote:
Explaining a joke is like dissecting a frog. You understand it better but the frog dies in the process.
Appears to rely on surprise as well. The audience is first puzzled at how the two processes can be alike, and is then delighted to discover a clever way in which they are. Moreover, "dissection" casts things in a messy and gruesome light, whereas you wouldn't think that explaining something as simple as a joke could possibly be gruesome. Lastly, there is the apt observation (requiring also some thinking from the audience to see) that explaining, rather than enhancing the humor as one might expect, paradoxically detracts from it.
The spirit of the stairs also implies some connection between surprise and humor, along with many related jokes about certain groups of people who take inordinately long to "get" a joke. The latter in turn implies that in jokes there is something to "get", ie. something non-obvious, or surprising, that must be uncovered by the mind.