Letting readers experience how your characters speak adds depth to a narrative and invites readers into closer contact with the world in your story. The way you add these conversations to your story affects how easily the story reads, and how much your readers will get to know -- and care about -- your characters.
Format Dialogue Appropriately
The standard approach to writing dialogue in a narrative is to place spoken lines in quotation marks, and to indent for a new paragraph each time the speaker changes. These two rules, however, while hard-lined for academic writing, are not so strict when it comes to creative writing projects. Some writers, such as James Salter in his story "Last Night," forgo quotation marks for "em" dashes in front of the first word of each passage of dialogue. Others leave out markers altogether. The way you format dialogue primarily is a stylistic decision, but make sure it doesn't go against the style of the narrative.
Fold Dialogue Into the Prose
At certain times, your story may call for a conversation to be lines of dialogue and not much else. Other times, the effect you want needs additional descriptions of actions to enhance the scene. For example, in Hemingway's "Hills Like White Elephants," the two main characters are sitting at a table and much of the scene is one line of dialogue followed by the next, with little description to accompany it. If you were writing a scene, however, in which an officer is instructing another about how to disarm an explosive device moments before detonation, you would want to mix lines of narration into the conversation to show how the characters are reacting to the situation; this increases the tension.
Strive for an Authentic Feel
Unless you're writing nonfiction, writing dialogue that perfectly mimics real-life conversations might not be the best objective. You want dialogue that is authentic but doesn't have many of the awkward sounds of informal speech people routinely use. That said, writing truly authentic dialogue that is convincing and powerful is possible; it simply takes a remarkable amount of skill. Regardless of your approach, always allow characters to speak in their own unique voices. In nonfiction, this might seem obvious, but you might be tempted to tailor a fictional character's vocal style to your own standards of written language. Treat your characters as if they were real, and let them control their own tongues.
It's All About Character
Dialogue benefits narratives in several ways. It theatricality enhances and entertains. It also adds different voices to the story and keeps it fresh. A scene of dialogue can move the plot of a story forward. The most important purpose of dialogue, however, is to reveal the personalities of the speakers. Everything a character says should provide insight into whom this person is and how he or she perceives the world, which makes that character more dynamic and real in the reader's imagination. When reading over a section of dialogue you've written, always ask yourself if the lines do their jobs of revealing character. If they don't, consider rewriting the passage until they do.