Witty dialogue is found in most Regency romances, and the comedies of Shakespeare are rife with word plays and banter between clever characters, but it also has a place in other writing.
Put two clever characters with a sense of fun together and let them at each other so they duel with words, and the reader is in for a treat that requires as much attention to the word play as the characters must pay.
This is from an unpublished contemporary novel.
"You have the tail of an ass," Ariel said.
David raised one eyebrow haughtily. "Women have told me I have a nice ass, but not one has mentioned a tail."
"They told tales."
"I am happy you are named for the sprite Ariel and not Puck. I could wake up from my afternoon nap with the head of an ass."
"Do not toss Shakespeare at me, amateur, or speak of Bottom. Why change your head into an ass? It would be redundant since you act like one already."
Witty dialogue, particularly in a romance, is emotional and personal foreplay. It reinforces a sense that these people “get” each other and are equals emotionally and intellectually.
Outside of romance, the most surprising and common use of witty dialogue is between the hero and the villain who also “get” each other.
Dueling with words can be just as much fun for the characters and the reader as dueling with swords, and just as dangerous.