Some claim that humour cannot or should not be explained. Author E. B. White once said that "Humour can be dissected as a frog can, but the thing dies in the process and the innards are discouraging to any but the pure scientific mind." However, attempts to do just that have been made, as follow.
The term "humour" as formerly applied in comedy, referred to the interpretation of the sublime and the ridiculous. In this context, humour is often a subjective experience as it depends on a special mood or perspective from its audience to be effective. Arthur Schopenhauer lamented the misuse of the term (the German loanword from English) to mean any type of comedy.
Language is an approximation of thoughts through symbolic manipulation, and the gap between the expectations inherent in those symbols and the breaking of those expectations leads to laughter (This is true for many emotions, and is not limited to laughter). Irony is explicitly this form of comedy, whereas slapstick takes more passive social norms relating to physicality and plays with them. In other words, comedy is a sign of a 'bug' in the symbolic make-up of language, as well as a self-correcting mechanism for such bugs. Once the problem in meaning has been described through a joke, people immediately begin correcting their impressions of the symbols that have been mocked. This is one explanation why jokes are often funny only when told the first time.
Another explanation is that humour frequently contains an unexpected, often sudden, shift in perspective. Nearly anything can be the object of this perspective twist. This, however, does not explain why people being humiliated and verbally abused, without it being unexpected or a shift in perspective, is considered funny - ref. The Office.
Another explanation is that the essence of humour lies in two ingredients; the relevance factor and the surprise factor. First, something familiar (or relevant) to the audience is presented. (However, the relevant situation may be so familiar to the audience that it doesn't always have to be presented, as occurs in absurd humour, for example). From there, they may think they know the natural follow-through thoughts or conclusion. The next principal ingredient is the presentation of something different from what the audience expected, or else the natural result of interpreting the original situation in a different, less common way (see twist or surprise factor). For example:
A man speaks to his doctor after an operation. He says, "Doc, now that the surgery is done, will I be able to play the piano?" The doctor replies, "Of course!" The man says, "Good, because I couldn't before!"
Both explanations can be put under the general heading of "failed expectations". In language, or a situation with a relevance factor, or even a sublime setting, an audience has a certain expectation. If these expectations fail in a way that has some credulity, humour results. It has been postulated that the laughter/feel good element of humour is a biological function that helps one deal with the new, expanded point of view: a lawyer thinks differently than a priest or rabbi (below), a banana peel on the floor could be dangerous. This is why some link of credulity is important rather than any random line being a punchline.
For this reason, many jokes work in threes. For instance, a class of jokes exists beginning with the formulaic line "A priest, a rabbi, and a lawyer are sitting in a bar..." (or close variations on this). Typically, the priest will make a remark, the rabbi will continue in the same vein, and then the lawyer will make a third point that forms a sharp break from the established pattern, but nonetheless forms a logical (or at least stereotypical) response. Example of a variation:
A gardener, an architect, and a lawyer are discussing which of their vocations is the most ancient. The gardener comments, "My vocation goes back to the Garden of Eden, when God told Adam to tend the garden." The architect comments, "My vocation goes back to the creation, when God created the world itself from primordial chaos." They both look curiously at the lawyer, who asks, "And who do you think created the primordial chaos?"
In this vein of thought, knowing a punch line in advance, or some situation which would spoil the delivery of the punchline, can destroy the surprise factor, and in turn destroy the entertainment value or amusement the joke may have otherwise provided. Conversely, a person previously holding the same unexpected conclusions or secret perspectives as a comedian could derive amusement from hearing those same thoughts expressed and elaborated. That there is commonality, unity of thought, and an ability to openly analyse and express these (where secrecy and inhibited exploration was previously thought necessary) can be both the relevance and the surprise factors in these situations. This phenomenon explains much of the success of comedians who deal with same-gender and same-culture audiences on gender conflicts and cultural topics, respectively.
Notable studies of humour have come from the pens of Aristotle in The Poetics (Part V) and of Schopenhauer.
There also exist linguistic and psycholinguistic studies of humour, irony, parody and pretence. Prominent theoreticians in this field include Raymond Gibbs, Herbert Clark, Michael Billig, Willibald Ruch, Victor Raskin, Eliot Oring, and Salvatore Attardo. Although many writers have emphasised the positive or cathartic effects of humour some, notably Billig, have emphasised the potential of humour for cruelty and its involvement with social control and regulation.
A number of science fiction writers have explored the theory of humour. In Stranger in a Strange Land, Robert A. Heinlein proposes that humour comes from pain, and that laughter is a mechanism to keep us from crying. Isaac Asimov, on the other hand, proposes (in his first jokebook, Treasury of Humor) that the essence of humour is anticlimax: an abrupt change in point of view, in which trivial matters are suddenly elevated in importance above those that would normally be far more important.