In general, comic relief exists when an author includes humorous characters, events, or dialogue in order to ease the tension and/or seriousness of a story. When a story is too emotionally or mentally draining, the reader may need a sort of break; the inclusion of comic relief allows the reader (or audience) to relax and be prepared for more serious elements to come. If a play like Romeo and Juliet did not include some humor, the audience could easily grow weary of being unable to release the tension it feels; the intensity of the emotions that the audience experiences might become overwhelming and result in an unsatisfactory experience.
Often, the characters who are employed in order to provide comic relief are flat, static characters, such as Sampson and Gregory. However, Shakespeare did include a sense of humor in the character traits of some round, dynamic characters, such as Mercutio and the Nurse. While these characters play important roles in the serious aspects of the play, they also provide the important element of comic relief.
Comic relief is a writer's device used in a passage or scene of high tension or emotion. A character or event creates or performs some action with humor that is an attempt to lessen the anger or sadness of the situation. Shakespeare is a grandmaster of using the fool character for comic relief. There is at least one fool in each play who is a master at releasing the pressure valve in tense situations.