Definition of a Pun
What is a pun?
In Italian, 'puntiglio' means "a fine point," hence a verbal quibble, and is most likely the source of the English "punctilious."
A pun is defined by Webster as "the humorous use of a word, or of words which are formed or sounded alike but have different meanings, in such a way as to play on two or more of the possible applications; a play on words."
Why do people groan when a pun is told?
A pun is often considered obvious humor, since the person relating it is merely balancing the humor in it on a twist of a word's meaning or sound. Children love this type of obvious humor and can laugh at it without reproachments.
Adults, on the other hand, are more likely to have a twinge of envy, and "why didn't I think of that?". It is this envy in adults that subconciously causes them to groan upon hearing a pun. As time goes on, it can only be hoped that we adults will eventually learn to react more like a child and less like a groan-up!
Different Types of Puns
There are different types of puns.
Homographic puns make use of multiple meanings from a single spelling (e.g., "pen" for writing instrument or animal enclosure). These are also referred to as "antanaclasis".
Homophonic puns use like sounds but with different spellings and meanings. This is also referred to as polyptoton. Examples of homophones are scent and sent, jeans and genes, waive and wave, and buy and bye.
What is it that makes a good pun?
Here are the recommended ingredients:
Quick setup (brevity is important), no proper names (listener might not recognize the name), familiar references, a pointed revelation (you should see the spark in the listeners' eyes as they 'get it'), and finally, maximum wordplay throughout.
Thanks to Pun FAQtory for some of this information.