Many people recommend saying dialogue out loud when writing. You may or may not want to do exactly that (talking dialogue out loud can take time and possibly kill the momentum of writing the story/script) but at the very least you should imagine the dialogue in your head to ensure it sounds "right".
Note that I said "right", not "real". Oh, don't get me wrong: if you can make the dialogue sound real for the story you are trying to tell, you should. And certainly if a story is slice of life, that's the way to go. But remember that your primary goal when writing dialogue is to help create the world your character is inhabiting.
By way of example, if you're writing a Superman story, Superman is so larger than life that his words should have extra weight. If you go too real, you might lose the effect that this is the kind of guy whom other heroes are in awe of. Or if you're writing the script for a slasher flick, you might want to make the victims a bit one dimensional in their dialogue so that the reader doesn't wind up an emotional wreck from all the killings. If you're doing satire, the dialogue should should fairly real, but have a bit of an oomph to it so the reader/viewer realizes you're not being completely serious.
Don['t dumb down the dialogue for the masses but don't pepper the dialogue with some many in jokes or so many professional terms that only a tiny fraction of the audience understands what the hell the characters are saying.
Invariably your audience is going to miss/forget stuff, so find ways to have characters make references to past events while not being transparent about it. Maybe a character snaps at someone and then apologizes, mentioning that the earlier event has them on edge. If you can't make it work without seeming transparent, don't force it. Maybe the character needs to be in a different situation before they'd naturally talk about it.
Remember that body language is dialogue too. Consider this:
"Oh yes," she said, "I love you," as she gazed into his eyes.
Now this:
"Oh yes," she said, "I love you," she said. She grabbed a wine glass and threw it to the ground.
In the first case the dialogue is sincere, in the second case the exact same words are sarcasm.
At this point I shall say, "Adieu," but this is helping me formulate a few things in my head so don't be too shocked if there's more essays to come on dialogue and other aspects of storytelling. For now I want to conclude, make the dialogue real or not, but at least ensure the dialogue facilitates the characters' world.