It may sound surprising, but a joke and a crime novel work in very much the same way. The comedian/writer leads their audience along the garden path. The audience know what's coming, or at least they think they do until they get hit from a direction they were not expecting.
— Mark Billingham