Shaggy dog stories play upon the audience's preconceptions of the art of joke telling. The audience listens to the story with certain expectations, which are either simply not met or met in some entirely unexpected manner.
One such story is "The Encounter with the Horrible Monster," a shaggy dog story that is told as if it were a horror story. The story is a tale of a horrible monster (or an escaped lunatic, or an escaped prisoner, or a gorilla), that pursues a character implacably. After a lengthy exposition describing the pursuit, during which the audience's expectations of a horrendous climax are built up, the monster eventually corners his victim, at which point he touches him saying "Tag! You're it!
Shaggy dog story has come to also mean a joke where a pun is finally achieved after a long (and ideally tedious) exposition. This is also called a feghoot. The humor in the punch line may be due to the sudden, unexpected recognition of a familiar saying, since the story has nothing to do with the usual context in which the phrase is normally found, yet the listener is surprised to discover it makes sense in both situations. Therefore, if the audience is not already familiar with the phrase used in the punch line, or is not aware of the multiple meanings of the words in the phrase, the surprise ending of the joke cannot be recovered by explaining the joke to the audience.
An example of this type is The Rarie, in which a cute pet grows so large (described in many stages) that its owner cannot keep it. He loads the Rarie onto a lorry and drives to a cliff, and is about to tip the animal over the brink when it looks out and says "hey, that's a long way to tip a Rarie"...
Another example is the 'War Story' joke, in which the narrator presents his audience with insurmountable odds, and as the antagonistic forces close in, ends the story. When the audience clamors to know what happened next, the narrator simply responds, "I died."
A shaggy dog story may not have a pun at all; the humor (if any) is then derived from the fact that the joke-teller held the attention of the listeners for a long time (such jokes can take five minutes or more to tell) for no reason at all (an anticlimax).
One joke of this type is "The Purple Flower." In this joke, with much detail and narration, a young boy is expelled from his elementary school and abandoned by his parents because he called a girl a "purple flower." He eventually hears of an old woman who can tell him why the term is so offensive; as he goes to find her, he sees her across the street and runs towards her, getting hit by the bus and dying as he crosses the street. The audience is then told that the moral of the story is that you should look both ways before you cross the street.
A more ribald or scatological version is The Aristocrats.
Isaac Asimov, whose specialties included both science fiction and humor and who was a self-described "punster", wrote a short story called "Shah Guido G.," referring to the story's Atlantean ruler. The story ends on an anticlimax, and when a reader protested that it was "nothing but a shaggy dog story," Asimov pointed out that the title "Shah Guido G." could also be read as "Shahgui [i.e. shaggy] Dog," indicating this had been his intention.
A boy owned a dog that was uncommonly shaggy. Many people remarked upon its considerable shagginess. When the boy learned that there are contests for shaggy dogs, he entered his dog. The dog won first prize for shagginess in both the local and the regional competitions. The boy entered the dog in ever-larger contests, until finally he entered it in the world championship for shaggy dogs. When the judges had inspected all of the competing dogs, they remarked about the boy's dog: "He's not so shaggy."
However, authorities disagree as to whether this particular story is the archetype after which the category is named. Eric Partridge, for example, provides a very different story, as do William and Mary Morris in The Morris Dictionary of Word and Phrase Origins.
According to Partridge and the Morrises, the archetypical shaggy dog story involves an advertisement placed in The Times announcing a search for a shaggy dog. In the Partridge story, an aristocratic family living in Park Lane is searching for a lost dog, and an American answers the advertisement with a shaggy dog that he has found and personally brought across the Atlantic, only to be received by the butler at the end of the story who takes one look at the dog and shuts the door in his face saying "But not so shaggy as that, sir!" In the Morris story, the advertiser is organizing a competition to find the shaggiest dog in the world, and after a lengthy exposition of the search for such a dog a winner is presented to the aristocratic instigator of the competition, who says "I don't think he's so shaggy.