There is no real formula to humor, however make humor often works when it makes the viewer feel superior to others, reduces the
emotional impact of anxiety-provoking situations, or surprises the viewer.
http://www.laughlab.co.uk/ did research into what makes a funny joke, and has interviews and...