He or she assumes the role of editor. Just as an editor removes minor flaws from a text, so must a writer act on behalf of characters' speech. Experienced writers force subject-verb agreement into conversation, unless poor grammar is essential to a character. Most importantly, writers do not allow characters to ramble unless it is a device to communicate nervousness or another trait. Readers and audiences seldom notice well-edited dialogue.
Good dialogue fits seamlessly within the story.
If a sentence does not fit this law it should be killed. In dialogue, every word is important. Dialogue breaks the narrative of a story or the visuals of a film. Readers and audiences pay closer attention to dialogue because it is special. A ten minute conversation condenses into three paragraphs.