In fiction, the town drunk character serves a number of functions.
The town drunk may serve merely as a moral example and object lesson on the evils of drunkenness. This approach to the character is associated with the "temperance" movement, and peaked at the start of the twentieth century. The Prohibition film Ten Nights in a Barroom portrays the inevitable fall into destitute drunkenness of a person who dared to take that "Fatal Glass of Beer", the title of another period drama working this vein. A town drunk who appears in Our Town by Thornton Wilder is perhaps the most often seen example of this version of the character. Pap Finn in The Adventures of Huckleberry Finn is another famous example. In modern fiction, which tends to reflect the contemporary influences of the sobriety movement, the town drunk may get sober and set about revitalizing his life.
The town drunk may play the role of the fool as a source of comic relief. "Otis" from The Andy Griffith Show is this type of town drunk, as shown in the character of Bobby Singer in the CW series Supernatural, and as are many of the denizens of Moe's Tavern from The Simpsons such as Barney Gumble. In Shakespeare's Macbeth, the Porter who appears in Act II, Scene 3, is also a type of "comic relief" drunk who serves to temporarily lighten the mood of the play right after a heinous regicide has taken place.
In a similar vein, the town drunk may serve as a jester figure, a semi-comic proxy for the Wise Old Man. He may disrupt public meetings, either for comic effect, or by dispensing what proves to be wisdom in a garbled and comic form. Or, in this incarnation, the character may introduce the hero to some of the worldlier sorts of wisdom, as well as forming a contrast to his truly heroic character. One prototype for this version of the town drunk is supplied by Shakespeare's Falstaff, who appears in both parts of Henry IV and in The Merry Wives of Windsor. Another would be the drunk who appears in at the low point of the film, where his drunken ramblings inspire the hero to save the world.
Frank Gallagher, from the TV seriesShameless, is a quintessential town drunk and rarely appears in the series without being intoxicated.