A joke is a short story or short series of words spoken or communicated with the intent of being laughed at or found humorous by the listener or reader. A practical joke differs in that the humour is not verbal, but mainly visual (e.g. putting a custard pie in somebody's face).
Jokes are performed either in a staged situation in front of an audience, or informally for the entertainment of participants and onlookers. The desired response is generally laughter, although loud groans are a common response to some forms such as puns and shaggy dog stories.
Psychology of jokes
Why we laugh has been the subject of serious academic study, examples being:
Henri Bergson, in his book Le rire (Laughter, 1901), suggests that laughter evolved to make social life possible for human beings.
Sigmund Freud's "Jokes and Their Relationship to the Unconscious".
Marvin suggests that laughter has a specific function related to the human brain. In his opinion jokes and laughter are mechanisms for the brain to learn Nonsense. For that reason, he argues, jokes are usually not as funny when you hear them repeatedly.
Edward de Bono in "The Mechanism of the Mind" (1969) and "I am Right, You are Wrong" (1990).
Edward de Bono suggests that the mind is a pattern matching machine, and that it works by recognizing stories and behavior and putting them into familiar patterns. When a familiar connection is disrupted and an alternative unexpected new link is made in the brain via a different route than expected, then laughter occurs as the new connection is made. This theory explains a lot about jokes. For example:
Why jokes are only funny the first time they are told: once they are told the pattern is already there, so there can be no new connections, and so no laughter.
Why jokes have an elaborate and often repetitive set up: The repetition establishes the familiar pattern in the brain. A common method used in jokes is to tell almost the same story twice and then deliver the punch line the third time the story is told. The first two tellings of the story evoke a familiar pattern in the brain, thus priming the brain for the punch line.
Why jokes often rely on stereotypes: the use of a stereotype links to familiar expected behavior, thus saving time in the set-up.
Why jokes are variants on well known stories (eg the genie and a lamp): This again saves time in the set up and establishes a familiar pattern.