Unable after searching to recover my notes for a course I taught during the eighties on the idea of comedy, I have here attempted to set down my views in summary. Though these notes lack much in the way of illustrations, authorities, and documentation, they represent my current thinking.
All art brings beauty and pleasure, but comedy brings gaiety and joy as well. Thematically, in the broadest sense, comedy represents a positive response to life, an affirmation, a celebration, a delight. This is neither more nor less accurate (that is, true to experience) than the pity and fear of tragedy or the simpler sympathy of sentiment and melodrama; it is their complementary counterpart. At the conclusion of the Symposium, when the partiers are for the most part, passed out, Socrates is maintaining the equivalence of the two.  Don Quixote, Pantagruel, and Falstaff are certainly as profound to readers as Agamemnon or Hamlet, and likely to be more moving than any hero in Racine. When we momentarily feel successful (or even indifferent) in dealing with the terms of existence, or when we choose to play at feeling such victory, we laugh.
Aristotle tells us that tragedy provides catharsis through pity of the other (compounded, I would add, of charitable love for fellow humans and Schadenfreude at witnessing someone else’s misfortunes). Fear arises since every member of the audience is aware that the fate of every individual is inevitably tragic. Looking at life straight on with open eyes may naturally elicit a tragic response. But a later ancient text which may preserve Aristotelian theory says that comedy “through pleasure and laughter” effects “the purgation of like emotions.”  In other words, ultimately the functions of tragedy and comedy are precisely parallel; both enable one to go on in spite of the intolerable conditions of life.
In comedy, the self is generally normative, observing with a critical eye the foolishness of those on every side. Thus humor requires a butt and comedy is often quite aggressive.  The characters in American half-hour comedy television shows pass their lives insulting those around them; in Oscar Wilde, the benighted Philistine is put down; in Huckleberry Finn America is lacerated without mercy. Here comedy is close to its roots in the ancient komos Old Comedy, and the modern Carnival with ridicule of prominent people, a trend that continues unbroken into the present. 
At the same time, though, comedy can seem amoral, when it tends to view faults abstractly as incongruity, as oddly amusing grotesque distortions in a formal pattern rather than as the source of pain and suffering. In caricature the lovesick youth, the miser, the braggart, the macho man and all other endless varieties of human folly appear as sideshow attractions rather than psychological, spiritual, or social pathologies causing real harm. Bergson insists on “the absence of feeling,” what he calls “a momentary anesthesia of the heart” required for comedy, itself “wholly intellectual.”  According to Aristotle, the ridiculous must never be “painful nor destructive.” Of course, Wile E. Coyote is never injured, though he may be smashed like a pancake or blown into the sky, he returns ever undiminished. So the whole competition between him and the Roadrunner, between the Signifying Monkey and the lion, between Chaplin and the bushy-browed Eric Campbell, all contention seen through a comic lens is finally a game, a pretence, a sport to while away a lifetime.
Paradoxically, though, comedy does in the end care a great deal about consequences, for every comedy must end happily. Every situation comedy ends in the restoration of a harmonious family, every romantic comedy ends in marriage. Human beings are such social animals that the endangerment of the social group by an individual’s violations of convention is seriously disturbing. Harmony must be reconstituted, if only through the sympathetic magic of drama.
Aristotle notes that comedy is “an imitation of characters of a lower type,” portraying as “ludicrous” “some defect or ugliness.”  The viewer will feel superior to the comic figures (though suspecting that the difference may be uncomfortably small) just as he feels inferior to the heroes of tragedy (while knowing that their fate is his in the end). Comedy finds amusement in every vice and failing – selfishness, libertinism, paranoia, vanity most all. Every fault is in fact a sort of vanity and ignorance – with a clear and objective view (like the reader) one would never behave in a ludicrous fashion.  By defining lapses, one defines norms. Comedy has been considered fundamentally conservative by some and inherently subversive by others because it is equally likely to criticize a present offender by calling for a return to earlier ideals or by denouncing the outdated values of the present and proposing radical new ones.
Apart from character faults, comedy exploits our physicality. Faults which are body-based such as gluttony and lust are a rich source of laughter, but moral failing need not come into the picture -- perfectly ordinary facts will work as well: sex, excretion, farts, belches, sleepiness, sweating, slipping on a banana peel. In fact, commonality lies behind the comic impetus to deflate the pompous with such expressions as “he thinks his shit don’t smell” or “he puts on his pants like the rest of us, one leg at a time.” However, this basis for universal sympathy can equally serve to stigmatize individuals. Any anomaly, including physical defects or simply unusual characteristics such as short stature, red hair, or minority racial identity, can be fair game, as every elementary school child knows. 
The incongruity that inspires laughter may be of any sort, in Aristotle’s language “that which is out of time and place, without danger.” It may arise from exaggeration or disproportion , indeed from any difference. A phrase whose meaning shifts between two possibilities, a sucking puppy among the piglets, a soldier out of step, an Amish rap singer, the possibilities are endless. According to Emerson  “The balking of the intellect, the frustrated expectation, the break of continuity in the intellect is comedy.”
Comedy is clearly associated in particular with topics about which people are anxious, such as sex, drunkenness, and social propriety in general. Laughter brings a simultaneous physical relief of tension and restraints and the intellectual assurance that reassurance that our own trials may, like those of comic characters, be overcome. Laughter has a social function , chastening nonconformists and creating a sense of shared values and feelings in the audience.
The deepest roots of comedy are surely in the rituals of springtime, the joy of the earth’s regreening, the acceptance that welcomes the replacement of the old with the new. The promise of the spring and the reappearance of fresh produce must have been associated with high spirits. 
There is finally a sort of cosmic comedy, reflected in the daily laughter among Tibetan monks, or that of altogether mythic figures as Durga who roars with laughter as she decapitates Mahishasura. Nietzsche provides a secular analogue in his story about Zarathustra coming across a shepherd with a snake in his throat. Horrified, Zarathustra urges the man to bite the serpent’s head off. When the shepherd does, he suddenly becomes “changed, radiant, laughing.” “Never yet on earth has a human being laughed as he laughed. Oh my brothers, I heard a laughter that was no human laughter; and now a thirst gnaws at me, a longing that never grows still. MY longing for this laughter gnaws at me.”  This is nothing less than the laughter in reaction to the absurdity of existence. “The deeply wounded have Olympian laughter; one has only what one needs to have” 
Emerson makes a similar point sparing the symbolic apparatus. “The whole of nature is agreeable to the whole of thought, or to the Reason; but separate any part of nature and attempt to look at it as a whole by itself, and the feeling of the ridiculous begins. The perpetual game of humor is to look with considerate good nature at every object in existence, aloof as a man might look at a mouse, comparing it with the eternal Whole; enjoying the figure which each self-satisfied particular creature cuts in the unrespecting All, and dismissing it with a benison. Separate any object, as a particular bodily man, a horse, a turnip, a flour-barrel, an umbrella, from the connection of things, and contemplate it alone, standing there in absolute nature, it becomes at once comic; no useful, no respectable qualities can rescue it from the ludicrous.” 
1. More precisely, he claims that at a gifted tragedian should also be able to write comedy.
2. From the Coislinian Tractate, an anonymous condensation of a work from the first century B.C.E. Proclus and Iamblichus also treat comedy as catharsis. In the twentieth century Elder Olson revived the term katastasis as a comic analogue to catharsis, defining it as the “restoration of the mind to a pleasant, or euphoric, condition of freedom from desires and emotions; conversion of the grounds of concern into nothing.”
3. See the Philebus, particularly 48-50. To Plato, comedy works through phthonosor malicebeing pleased at the misfortunes of our neighbor (Philebus 48a).
4. The same principle occurs worldwide. For instance, the ancient Irish kings feared being lampooned in a glam dicenn (satire-poem). Of course, in the Middle Ages poets were considered so close a thing to magicians that they were also believed to be able to bring real boils to the face of a victim. In West Africa, the Ibo “moon-songs” sometimes ridicule individuals who have violated group norms.
5. In “Laughter: An Essay on the Meaning of Comic,” translated by Cloudesley Brereton L. es L. (Paris), M.A. (Cantab) and Fred Rothwell B.A. (London). Bergson says, “It seems as though the comic could not produce its disturbing effect unless it fell, so to say, on the surface of a soul that is thoroughly calm and unruffled. Indifference is its natural environment, for laughter has no greater foe than emotion.” Also, “to produce the whole of its effect . . . the comic demands something like a momentary anesthesia of the heart. Its appeal is to intelligence, pure and simple.”
6. Chapter V of the Poetics, Butcher’s translation. He is followed by the Coislinian Tractate and by Cicero who, in “On the Character of the Orator,” says “turpitudine.” In the twentieth century Northrup Frye used Aristotle as the basis of his analysis of the “low mimetic mode” in Anatomy of Criticism.
7. Plato says comedy springs from “ignorance of self.”
8. There is a reference to a dancing dwarf in the court of Neferkere during the Sixth Dynasty of Egypt (Third Millennium B.C.E.).
9. Cicero in On the Character of the Orator uses the term “deformitate.”
10. In “The Comic.”
11. This is Bergson’s third principal point.
12. Some authorities would link the customs associated with All Fool’s Day with the old medieval New Year just before.
13. Emphasis in the original from Walter Kaufmann’s translation of Thus Spoke Zarathustra, 3rd Part, “On the Vision and the Riddle.”
14. Friedrich Nietzsche, The Will to Power, translated by Walter Kaufmann and R. J. Hollingdale, fragment 1040.
15. From “The Comic.”