Kieran Setiya has an interesting post, What's So Funny About That?, on the incongruity theory of humor. In James Beattie's famous summary:
Laughter arises from the view of two or more inconsistent, unsuitable, or incongruous parts or circumstances, considered as united in one complex object or assemblage, or as acquiring a sort of mutual relation from the peculiar manner in which the mind takes notice of them.It's worth noting, though, that the incongruity theory as we find it in Beattie is in a sense not a theory of humor as such, but really something more like a theory of the disposition to laughter. While humorous situations are perhaps the situations in which we are most likely to be laughing, and are perhaps even the central and paradigmatic situations, the disposition to laughter is relevant to a lot of other situations, some of which are not humorous, and some of which may not even involve actual laughter.
A good example of how this makes a difference is the argument, found in different versions both in Beattie and Alexander Gerard, that even where there are incongruities, if the incongruities also trigger strong reactions from some other sense, internal or external sense, this strong reaction might prevent or override anything relevant to the ridiculous or ludicrous. The obvious example is extreme evil clearly presented -- extreme evil always involves extraordinary incongruities, but clear presentations of extreme evil are not funny, because of the shock to our moral sense. Likewise, very painful incongruities are not funny, precisely because they are very painful, things that spark strong feelings of pity are not funny because of the strong feelings of pity, and so forth.
And this arguably fits the phenomena, because there is a spread in risibility. You have humorous laughter arising from incongruities and absurdities alone, uneasy and uncomfortable laughter arising from the first basic interaction with unpleasant feelings, bitter laughter when the latter are much greater. Then you have situations where you don't laugh because something distracts you or has a greater impact on you at the time, even though you might have laughed under different circumstances. From my own case, I think this is often true of cases in which we are extremely exasperated -- only slightly exasperated, and we might still laugh in exasperation, but there's a point beyond which we are just exasperated. All of these are things that we find in cases of actual comedy and jokes; some comedians even like to see how far they can push the boundaries and still get a laugh.
And then you have situations where you have incongruities, but they come with such severely unpleasant feelings that you are not inclined to laugh at all, even while seeing the incongruity; perhaps in such cases the incongruity, insofar as it has a role, just adds force to the unpleasantness of the feeling instead of resulting in laughter, through the squelching of the disposition to laugh. And I think we find this, too; there are such things as humorless jokes, and one of their common uses in rhetoric is to intensify anger, hatred, or other negative reactions.