Why do you do this?
The answer is simple. Authenticity. If you were to just make up stuff as you wrote, the story could ring shallow. In fact, your readers will quickly realize that you are Blue Skying aka BS-ing them. Let me give you some examples of what I did to become knowledgeable of my subject matter.
In my novel, "2012: Timeline Apocalypse," I was out of my element to some extent. I'd be through the Panama Canal and had spent a week in Acapulco with a couple of day trips to see ruins. I had 'some' background to work with but, still, I wanted my story to ring with a little more reality than what I could remember of my trip back in the late 1960s. So I started to research.
Originally my story was going to take place Chichen Itza but I quickly realized that it was extremely too commercial for what I wanted to happen. I stumbled on Palenque and the great Mayan chief, Pacal. A little more research gave me his tomb which added to my story. Suddenly the story took on better depth and the Temple of Inscriptions came alive for me with other hidden possibilities.
Of course, having the ruins located a short distance from the city help add some ambiance. It allowed my character to embrace the locale, the freedom, the people and way of life.
Some more research gave me legends, myths and local religion. I added Mayan gods and used some of the ancient Mayan words to create names. I was consumed by what I was learning.
For my novel "Three Steps: The Journeys of Ayrold" I was intrigued by Ireland, home of my grandfather. Again, I started research and learned about Celtic magic, charms, potions and myths. With this in-depth studying, my story evolved from a lame tale of a man searching for his past to a story of a man learning who he is, who he was and who he wants to be. I used my old tromping grounds where I grew up for the beginning of the story but I've never been to Ireland. I needed to rely on the internet and local library to give me information. (Let me interject a note here -- don't rely on the internet as the only resource, not everything on the internet is true!)
To make my leprechaun characters unique -- I got my idea from a sign I saw in a town I was passing through on my trip from Washington, DC back to NW Ohio. So, yes, the story has many true facts. One tidbit, I actually went to the Sheraton hotel on Connecticut Ave and rode the elevator to the 3rd floor and reviewed it. Things may have changed since then (1996) but still, at the time, it was an accurate description.
To sum it up, I became an instant Einstein, a fount of knowledge for my novels. Some of what I learned has stuck with me but much of it has dissipated into the nether realms. Still, for a brief moment in life, I was an Einstein.