There are genres that absolutely require research into speech patterns and vocabulary: alternate history, Westerns, period war epics. Regency romances, infamously. In other genres, it's useful, it's good to encourage, but honestly it's icing on the cake. You don't have to be a master linguist like Tolkein to write a good fantasy. (Thank goodness.)
I find it useful to be aware of the evolution of the English language in general. There are plenty of good books out there on the topic. Learning another language can teach you a lot about different ways to arrange information. I've heard over and over that learning Latin will blow your brain wide open, but I wasn't brave enough for that.
For the language of specific time periods, watching movies is an easy place to start. Movies are also the least reliable, of course. Thanks to the internet, you should be able to get some idea of a given movie's level of accuracy, though. Reading books written in your time period will teach you more. Even if there isn't much dialogue, the narrative voice can show you something about the voice of the times.
How much work you put into accuracy is entirely up to you, of course. Hampering your readers, or detracting from their enjoyment of the story, is always risky. Though on the other hand, there will also be readers who value accuracy. It's all about balance.
Things tend to shift in the writing. Plots, characters, dialogue too. As you get comfortable with the story, hopefully you'll get comfortable with the dialogue style too. It's one of the things I always go back and revise before calling a first draft finished.
If the dialogue is giving you trouble, though, one thing I've found helpful is writing throwaway scenes. Usually, it's a couple characters sitting around with minimal context telling each other stories -- something that's often not useful in the story itself. But it gives you a chance to work on their conversational style, both in the words and the give and take between them. Plus, you'll probably get some back story and character development out of it. All those "character interviews" I've done over at my blog? They're as much about the dialogue voice as the content, and looking at them I can see evolution.
Listen to your characters. You should always do this, and you should argue with them too. Dialogue is no different in this regard. Let them try on different styles, even ones that clash with their genre. Some things will stick, and some won't. They'll probably surprise you, and that's one of the things I love about writing.
Drop by tomorrow to see a chunk of my dialogue in the hot seat! :)