What makes a joke funny?
Everyone who knows how to tell a joke knows that it is very important to do it in a very specific way to keep it funny. Information needs to be delivered in a specific order. Information needs to be delivered at a specific rate: sometimes pausing, sometimes talking faster. All that also needs to be tailored to the type of person listening. Miss any of the ingredients and suddenly its not funny any more.
But why? Isn't it still the same information? The trick is that the "funny" is not *in* the information. The "funny" is in the surprise factor. And the only way the listener can be surprised is by hearing something unexpected. Which means the listener has to have an expectation in the first place, and it has to be wrong.
That is why telling a joke is an exercise in controlled misdirection. By controlling the order and rate of information delivery we make sure that the listener is building the wrong mental model of the story. At the moment of revelation the listener reevaluates his mental model, and realizes that the model that accommodates the punch line is more consistant than his own. Human beings really like the feeling associated with this interesting process, otherwise known as "thinking". By encouraging the listener to construct and reconstruct a mental model we make the funny happen.
By now it should be fairly obvious how similar this is to a good murder mystery. After all, the central premise of any detective story is that all the information needed to guess the murderer is provided to the reader in full. In the best written stories the author always derives different but more consistent conclusions without using any extra information. The trick is to do it before the reader does.
So, what of poetry?
Poems are designed grownd-up to encourage the reader to build a mental model for predicting what is about to be said. In addition to following the semantic of what is being said the reader gets additional syntactic clues from the rhyme. Whatever will be said has to rhyme!
Now, what about writing a rhyming joke about a murder mystery ?