Whether you're a reader or a writer, reading poorly-written dialogue is the same as being a musician and listening to music being played off-key. There's only so much of that you can take before it becomes almost painful -- and I think that's why so often bad dialogue is a book killer.
No one is a master of dialogue; a few authors come close but it's not something I believe can be mastered. We all wrestle with it, crafting it, reading it out loud, listening to it, trying to shape it into what it should be: something effortless and natural on which everyone wants to eavesdrop. If good dialogue is tough to compose, great dialogue is insanely difficult to bring to the page. I'm probably more forgiving than most writers when it comes to encountering bad dialogue because of this. Absolutely I will let pass the occasional "Hi, how are you?" and "Isn't the weather nice?" in order to get to the good stuff -- assuming there is some good stuff.
I wish I could sprinkle every writer with magic dialogue dust, but it doesn't exist. Like everything with writing, dialogue requires thought, practice and hard work. For me dialogue comes from a combination of listening and picking up rhythms in real life, letting that constantly percolate, and then pouring all of it into the characters and allowing them to draw on it to speak to me rather than me putting words in their mouth. While I'm listening to the character, I also have to be in their head, in their point of view, which puts me literally inside and outside the character. This is why head-hopping never works for me -- I can't switch back and forth within a scene; I'm too invested in the POV character.
Like any story element dialogue can be over-thought and over-written, and when that happens it loses the natural rhythm of speaking and engaging and becomes trapped atop a soapbox of stilted monologue-type speech making. Everything is grammatically correct, all the i's are dotted and the t's crossed, and it looks perfect because it is. The problem is none of us speak perfectly. We use bad grammar. We drop and pick up thoughts in mid-sentence. We bitch, we complain, we laugh through the shouts and we sob between the whispers. We're emotional creatures, often we don't think before we open our mouths, we react. Those reactions are raw and imperfect and real.
Every person has a distinct voice, too; what we say is unique to us, like a fingerprint. Ask twenty people to describe to you an event they all attended, and you'll get twenty different descriptions. Their word choices, statement structures, tonal emphasis, focal points and memories will all be slightly different. Some will go on and on about one thing; others will be more general. Their emotions will play a part as well. Did they event excite them, bore them, make them happy or push them into despair? What did they bring to the event? Was it after a bad day, a great day, or a nothing day in their lives? Were they happy to get out of the house, or did they wish they'd never left?
If you want to tap into your subconscious, which is where I think all great dialogue originates, considering all these very conscious things should happen before you begin writing. Let it all process, but when you begin writing, set the conscious things aside entirely. Put your characters in the scene, watch them, listen to them, and record it on the page. Once you've finished, take a break and disengage. Then, when your head is out of the story, edit the scene.
The primary dialogue litmus test I use for dialogue is my own awareness of it. If I know I'm reading dialogue, then I flag it. If I forget I'm reading and hear the characters in my head, I don't. The dialogue should flow across the page. If it doesn't, I don't fiddle with it too much; I don't think flow can be forced. When I find a line I don't like, I usually delete it. Once I've edited the rest the scene, I go back to the beginning, re-read and put myself back in the character's head to again listen and record what I hear from them.
For writing practice, you might take a pen and pocket notebook with you the next time you're going to be around a lot of people. Eavesdrop (discreetly) and jot down every interesting thing you hear someone else say. I do this all the time; here are some lines I overheard during my travels just the other day:
I wish I had them power tools.
You can fit anything into the bags. A truck if you wanted.
Those eggs look a little dark.
No more nuts. I mean it. Not a one.
She's been waiting a while so I'm gonna take her before you.
When you get home, take the best lines you heard in the real world, and turn them into a conversation between two of your characters. Another lesson I often give my students is to watch a recorded, new-to-them movie or television show, stop it in the middle of a conversation and write the rest of it as they imagine it might go, then start the show again and compare the results.
Emerson said In good writing, words become one with things. If dialogue should be one with anything, it's your ear. Don't just write it, listen to it, the way you would music, or birdsong, or the beat of a heart -- it should sound just as natural, and just as real.
PBW's Ten Things to Help Writers with Dialogue and Ten Things I Think about Your Dialogue Tags.
Author Amy Rose Davis talks about the rhythm of dialogue here.
When does dialogue overwhelm a story? Editor Beth Hill has some suggestions in her blog post Dialogue ~ My Characters Talk Too Much.
Julie Musil's blog post Dialogue ~ Make It Matter invokes how-to author James Scott Bell and offers some interesting tips on what dialogue should do for your fiction. (Added: sorry about the link not working; I messed up the code -- it should take you there now.)
(outside links gleaned from the wonderful writers' search engine over at The Writers Knowledge Base)