People are often told in entry-level creative writing classes to 'listen to how real people talk, and write like that', which is terrible advice. A transcript of spoken conversation is often so full of repetition, half-thoughts, and non-specific words ('stuff', 'thing') as to be incomprehensible — especially without all of the spoken cues of pattern and tone. Written communication works very differently, and making dialogue feel like speech is an artificial process.
Keely is right, but at the same time I see why the advice is given. I suspect the problem is that it's only half the advice. You should indeed listen to how people talk, but only as a base to build on — not as a source for transcription.
About once a month I go into the city and spend time with some friends, and before then I have any number of opportunities to sit by myself and listen to people. What strikes me the most is when people talk in a way that is not just natural but unguarded. They can't help but embody themselves. That stuff is worth listening to — but because it's a source of ideas to mine, not because it's worth reproducing forensically. Most people are indeed pretty scattershot talkers, and a little of that goes a long way in fiction, whether that fiction takes place on the corner of 53rd & 3rd or in the swamps of some godforsaken corner of Westeros.
That makes me think good dialogue is at least as much about selectivity and complementary storytelling as it is about having "a good ear". In fact, I suspect most of what people call "a good ear for dialogue" is not just about listening to other people, but knowing how much of what they hear can be used, and where, and to what end. It's about selectivity, which is a more important aspect of fiction and creativity generally than is talked about these days. (If painting were just a matter of reproducing all of what was there, it would have been abandoned for photography a long time ago.)
If you reproduce just enough of what someone says and in the right context to show what a babbler they are, then you don't have to subject the reader to a plethora of increasingly redundant examples. When someone speaks with an accent or stutters, we do not need to have our attention called to that every single time, because we have memories, we are not stupid, and we have better things to do with the space available on the page anyway. The way people describe things, their word choices, their sentence structures, their ability (or inability) to create metaphors or provide explanations or deliver instructions, are all just as interesting as the grosser aspects of how they talk. Even Hubert Selby Jr., with his phonetically-written dialog (ya gotta get ya book stamped or ya gonna get yurass inna sling) knew better than to rely on that to get him all the way home. He knew that his shop steward not only sounded differently from his labor boss, but put his sentences together differently and used different parts to do it.
I shouldn't sound like I'm backing away as fast as I can from the idea that listening to people will not help you write better dialogue. It will. But what you are listening to, and for, also matters.