I once did a theatrical performance about puns. Really it was just a play on words. (Thanks PunOfTheDay.com!)
Puns are not often funny unless they are unintentional. At best they can make people groan, and maybe chuckle with recognition - but belly-laughs are not likely. To make a good pun, one would need a good grasp on language - particularly homophones and homographs - also to love an ambiguous pronoun. It's worth listening to comedians who specialise in this form of comedy. Try Milton Jones, for example.
On the spot punnery is simply a case of spotting an odd connection between words and bringing it to people's attention.