Having a sense of natural speech patterns is essential to good dialogue. Start to pay attention to the expressions that people use and the music of everyday conversation. This exercise asks you to do this more formally, but generally speaking it’s helpful to develop your ear by paying attention to the way people talk.
But dialogue should read like real speech. How do you accomplish that? Alfred Hitchcock said that a good story was “life, with the dull parts taken out.” This very much applies to dialogue. A transcription of a conversation would be completely boring to read. Edit out the filler words and unessential dialogue — that is, the dialogue that doesn’t contribute to the plot in some way.
It should not be obvious to the reader that they’re being fed important facts. Let the story unfold naturally. You don’t have to tell the reader everything up front, and you can trust him or her to remember details from earlier in the story.
Remind your reader that your characters are physical human beings by grounding their dialogue in the physical world. Physical details also help break up the words on the page: long periods of dialogue are easier for the reader’s eye when broken up by description. (And vice versa, for that matter.) See the link above for examples of how this can work.
Veering too much beyond “he said/she said” only draws attention to the tags — and you want the reader’s attention centered on your brilliant dialogue, not your ability to think of synonyms for “said.”
Be aware of falling back on stereotypes, and use profanity and slang sparingly. All of these risk distracting or alienating your reader. Anything that takes the reader out of the fictional world you’re working so hard to create is not your friend. Read some examples of how to achieve the tone you want without stereotypes, profanity, and slang.
Pay attention to why things work or don’t work. Where are you taken out of the story’s action? Where did you stop believing in a character? Or, alternatively, when did the character really jump off the page, and how did dialogue help accomplish that? You can start reading like a writer with the link above, or pick up an anthology and start your own list of writers to learn from.
The rules for punctuating dialogue can be confusing: many writers need help getting them right in the beginning. Take some time to learn the basics. A reader should get lost in your prose — not feel lost trying to follow your dialogue.