This is a very important aspect of writing, especially if the work in question will be focusing on any number of issues: economical, social, political, psychological, and so on. The first thing to do when you've decided to write a work of any genre is to, of course, find a theme. Focus on a theme, and find ways to expand on it. Try not to have several deep themes in one book - you might get the reader a little confused and scrambling to pinpoint what exactly you're trying to show. If need be, try to get your themes interconnected, i.e. not too far off point from one another.
Start your research on the theme you've decided, and read books concerning it. If you're writing fiction and you decide to use real places in your book, you want the circumstances surrounding those places to be factual and true. Yes, your characters are fictional, but to concoct an engrossing theme that reveals something about your characters/the human condition, you have to place your characters in a realistic setting.
For instance, if the setting of your plot is to be during WW1, it goes without saying that you must get your facts right about events that actually happened at the time, their dates, year, and so on. If your story is, say, centered on the catastrophic 9-1-1 attack of 2001, you have to do your extensive research and get all the facts right about the events of that fateful day. Don't write what you 'think' must have happened, or what you think you may have heard on the news at the time. If you're writing about the human mind, psyche, and so on, do a proper research on that as well. If your story is to be based on colonial times in Africa, be sure to do extensive study and exploration, read much on the topic, and ask lots of questions. Some issues are sensitive while others are not; either way, let the facts that you present be concrete and real.
If you’re focusing a lot on a particular real-life setting, it’s imperative that you either read as much books and watch as much videos as you can about that particular place, or physically visit the place and spend some time on the ‘scene’ of your book. This will give you a more visually accurate picture and make your description clearer and appear more real. Let's take a look at some examples.
In the book Tell Me Your Dreams by Sidney Sheldon, the underlying issue that Sheldon explores is on Multiple Personality Disorder: how it operates, different situations that might trigger the disorder, and the major effects it can have on others.
In the African fiction Purple Hibiscus by Chimamanda Ngozi Adichie, we see colonialism as the underlying issue that leads to the central theme, and how they all tie back to the main character Kambili and the conflict surrounding her immediate family.
In George Orwell's allegorical fiction Animal Farm, we are shown the fundamental controversy of political corruption, with implicit reference to the period of the 1917 Russian Revolution. We see what Orwell is trying to tell us about war, political patterns, rulers, and how power can change dictators once they take their positions in office.
It's clear the books mentioned above involved intensive research long before the first drafts were written. Begin your research now, and make it thorough. Whatever factual events you mention whether in passing or with the purpose of expanding on it, do make sure that it's accurate.
Seasoned readers frown in disapproval when they read books that give incomplete facts about actual events or places - especially if it's obvious the author is influenced by the stereotypical depictions of the environment, people and/or culture in question. It shows they didn't actually spend adequate research time to find the real facts about the setting they chose to use in their works.
Research is absolutely important for authors of any genre, and a literary fiction writer is not exempted from this rule. Do your research, and do it well!