Comic relief

Comic relief is the inclusion of a humorous character, scene, or witty dialogue in an otherwise serious or dramatic work, often to relieve tension.

Definition
Comic relief usually means a releasing of emotional or other tension resulting from a comic episode interposed in the midst of serious or tragic elements in a drama. Comic relief often takes the form of, but is not limited to, a bumbling, wisecracking sidekick of the hero or villain in a work of fiction. A sidekick used for comic relief will usually comment on the absurdity of the hero's situation and make comments that would be inappropriate for a character who is to be taken seriously. Other characters may use comic relief as a means to irritate others or keep themselves confident.

Application
Sometimes comic relief characters will appear in fiction that is comic. This generally occurs when the work enters a dramatic moment, but the character continues to be comical regardless. External and internal comic reliefs can be separated based on the engagement within the story and the effect on the audience. An internal comic relief is a character or moment where the story is written in the story itself. Others are involved and can laugh along with the humor. While external comic relief moments occur whenever the audience is supposed to laugh but the characters do not.

History
Greek tragedy did not allow any comic relief within the drama, but had a tradition of concluding a series of several tragic performances with a humorous satyr play. Even the Elizabethan critic Philip Sidney following Horace’s Ars Poetica pleaded for the exclusion of comic elements  from a tragic drama. But in the Renaissance England Christopher Marlowe among the University Wits introduced comic relief through the presentation of crude scenes in Doctor Faustus following the native tradition of Interlude which was usually introduced between two tragic plays. In fact, in the classical tradition the mingling of the tragic and the comic was not allowed.

Function
Comic relief moments serve the purpose of allowing the audience to "break from the dark and heavy content" and advance the plot.

Examples
William Shakespeare deviated from the classical tradition and used comic relief in Hamlet, Macbeth, Othello, The Merchant of Venice and Romeo and Juliet. The grave-digger scene in Hamlet, the gulling of Roderigo in Othello, and the mockery of the fool in King Lear provide immense comic relief.

Take the Porter scene in Macbeth:

"Here's a knocking indeed! If a man were porter of hell-gate, he should have old turning the key…Who's there, i' the name of Beelzebub? Here's a farmer, that hanged himself on the expectation of plenty: come in time; have napkins enow about you; here you'll sweat for't…Faith, here's an English tailor come hither, for stealing out of a French hose: come in, tailor; here you may roast your goose."

In this scene, the Porter serves as the comedic relief. In the scene before, King Duncan is murdered by the Macbeth duo. After the scene, his body is discovered and the castle is thrown into hysteria. His chaotic scene in between serves as a comic relief moment to distract the audience from the gruesome content.