Most jokes are based on surprise. They take advantage of a confusion of language, or a twist in logic, or a contradiction of some perceived truth, or sometimes just saying something so shocking and offensive that the audience will gasp and then (hopefully) guffaw.
- Richard Herring