The subject of humor is a notorious black hole for serious theorizing. Nonetheless, I'd like to plow ahead and discuss ethnic humor, even though I am almost incapable of remembering specific jokes except the most embarrassingly awful stinkers.
Clearly, there are a lot of different kinds of humor — Steve Pinker of this list does a fine job of discussing in "How The Mind Works" the kind of humor (often pun-based) that changes the frame of reference: e.g., "Q. To raise money, why don't girl scouts sell brownies?" "A. Because as much as girl scouts might want to, the 13th amendment prevents them from selling their little sisters." [For non-Americans, "Brownies" are junior Girl Scouts.] (Note, Steve's chapter includes much better examples of that kind of joke, but I can't recall any of his.)
Most ethnic humor, however, is a subset of the "observational" humor that is currently dominant in the entertainment marketplace among Americans with 3 digit IQ's: e.g., the kind of Harvard Lampoon-derived gag-writing behind The Simpsons, Letterman's Top 10 lists and many sit-coms like Seinfeld.
I would suggest a very simple evolutionary model for accounting for the appeal of this kind of pattern recognition humor. Noticing similarities and differences is one of the fundamental methods of gaining knowledge about the world. As the motto of the college in Animal House puts it, "Knowledge Is Good," or to be less moralistic, knowledge is useful because it allows us to make more accurate predictions about reality, which allows us to make better decisions. Down through prehistory, people who made better decisions propagated their genes more than people who made lousier decisions.
For observations to be funny, however, they can't just be true, they need to be more vivid and memorable than plain truth. Thus, as a mnemonic device joketellers exaggerate truth to the point of logical absurdity. Laughter, then, would be a form of brain candy that natural selection has devised for us to make us enjoy learning patterns.
Ethnic humor falls into two classes: "Polish jokes" and "stereotype" humor. The former is the (now thankfully fading) American version of a nearly universal phenomenon of telling jokes about stupid people (another universal phenomenon) and giving the role of the idiot to a member of another ethnic group: "Q. How many Poles does it take to screw in a lightbulb?" "A. Three, one to hold the bulb and two to turn the ladder." The latter ("stereotype humor") is of a more closely observed sort that actually has some bearing in reality to traits that correlate with the group: "Q. How many lesbians does it take to screw in a lightbulb?" "A. That's not funny!"
Polish jokes: There is an obvious evolutionary benefit to having humans reflect upon and laugh at stupid ways to do things. Unfortunately, but not surprisingly (due to kin selection), we often try to claim that idiotic acts are an attribute of some other ethnic group than our own whom we dislike. (I always wondered why, of all the ethnic groups in America, there were all these nasty jokes about one of the most inoffensive of all immigrant groups?)
Stereotype jokes — "Observational humor" also dominates stand-up comedy today, which is now largely concerned with pointing out the differences between the sexes and ethnic groups. We've entered the new golden age of ethnic humor, with members of each group pointing out its own foibles: e.g., Chris Rock (black), Margaret Cho (Asian), Jeff Foxworthy (redneck), screenwriter Paul Rudnick (gay male), and of course a million Jewish comedians.
The new unwritten rule that only members of a particular group are allowed to make fun of it works relatively well, except for a few notably prickly and politicized groups like lesbians. This lack of honest, self- observant stand-up comedy among lesbians contributes to the bizarre assumption found constantly in the mainstream media that lesbians and gay men are very much alike, when in truth they are among the least similar groups imaginable. (See my article "Why Lesbians Aren't Gay" for a table of several dozen differences). Thus, you can learn more about race, ethnicity, sexual orientation, etc. today from watching late-night HBO comedy series like Chris Rock, Tracey [Ullman] Takes On, and Arliss than from reading New York Times editorials.
"Serious" journalists tend to believe that "funny" and "serious" are by definition mutually exclusive, when an evolutionary perspective would suggest that much of what is funny to us is funny because it's serious.