Pyromancer's node reminds me of this one-liner:
Why does my nose run and my feet smell?
I remember back in high school, we devoted a day in Humanities class to analyzing what humor was and what made something funny. There were various theories offered, from the silly to the unexpected to others I can't remember.
The one that stuck with me was that humor was something that made you feel superior. This isn't to say everything that makes you feel superior is funny, but that I think much of what we find funny can be interpreted as something that makes you feel superior.
Ethnic jokes are funny as long as they make fun of some other ethnic group. Political jokes are funny as long as they make fun of some other political group.
The problem with jokes like those above is that they can turn away parts of the audience. The more people that you turn away, the less successful the comedian. Many comedians instead find success in self-deprecating humor. They try to get their audience to feel superior to the comedian (thus the comedian does not risk losing "market share").
So what about the joke above about the nose and the feet? One claim is that people feel superior to themselves when they "get the joke" - that is, first they may not understand a pun, then they suddenly realize what it is, and suddenly feel superior to their past selves, when they didn't understand it.
Anyway, that's just conjecture. If you find this helpful in developing your own humorous writing, then I would appreciate an upvote. That will help me feel superior, but I won't think it's funny =]