Dialogue is never just talk.
Eavesdropping | The trick with dialogue is to listen. The writer needs to be out in the world with an “ear” for how people speak. Yes, the writer must become a big time eavesdropper. What you’re listening for are interesting lines — yes — but also, and more importantly, speech patterns (and subtext).
Why | The writer wants to be able to mimic how people speak, ungrammatically sometimes; the writer needs to mimic how often people say one thing, but mean another. The latter is fairly easy to capture. The former takes practice and is more difficult to observe, let alone understand in a real life conversation with someone you know.
Subtext | In order to write dialogue with subtext (sub: below. What’s beneath the text or dialogue.) the writer must know what any character speaking wants or desires. Given that when characters meet in fiction they hold divergent desires they will say things in order to get what they want and largely be in conflict with those opposing them who hold different values and needs. So remember, few, if any character, says what they mean. Can you imagine. “I want to know who my father was?” asks Harry. “Oh, he’s [blank],” says the evil dude in those Harry Potter novels. Game over. Everyone can go home now.
Picture the Iceberg | The classic way to visualize subtext is to picture one of those gigantic icebergs often pictured cut some ways up the ice by a waterline. What is visible above the waterline is usually far less than was is submerged, and out of sight. What a character says is “See the ice.” What the character means is “I’m much bigger, but I’m hiding my booty.” Subtext is the submerged ice.
Talk the Talk | The one thing to keep in mind too — in real life some people will talk just to talk. They love the sound of their own voices, we say. In fiction, this never happens otherwise you’d just be wasting a reader’s time. “Dialogue is never just talk,” writes Steven Schoen in The Truth about Fiction.
Other Things To Consider | While these are not hard and fast rules, a writer would be well served to: check the conventions of giving dialogue — the actual formatting of it — and stick with it whatever one you choose; avoid vernacular at all times; in fiction when you have a cast of characters, say in a novel, provide some of the characters verbal tics (tropes) to distinguish them to the reader who might be confused by so many characters (Oh, this one always says, you know, after every sentence); avoid narrative in your dialogue (John, my son, you know I have cancer); and seldom, if you can, use more than “said” as an attributive.