Now in the case of, say, the Star Trek universe, part of that was the nature of writing for television, especially in the 60s (as well as the 80s)-- writers tended to make something up on the fly because it seemed like an interesting idea (or in the old show's case, because it fit the sets and costumes they already had on hand), and they weren't really thinking about building a larger universe. Fair enough. But it does bug me, and I know that I can't write that way. Even if it has nothing to do with the story at hand, I need to know what's over that next hill.
Part of it has to do with geopolitics, which becomes a very complicated thing when you are looking at a 3-D map (or rather, a 2-D representation of 3-D space).
In my Space Opera setting, humans haven't ventured further than 25 light-years from Earth. They've met nine other starfaring species, and are aware of four other species that have yet to advance to spaceflight. But what have I worked out? So far, a 100-ly sphere from Earth, which is home for 60 different alien species, of which 25 of them are spaceborne. Now, admittedly, a lot of those species I don't have more than a paragraph of information... but I know they are there.
Also, my 100-ly radius sphere is a map of-- to the best of my ability to create-- the actual stars within 100 light years. On top of that, I've done my best to craft reasonable and realistic possibilities for the planets found around those stars.
One tool I use, besides an enormous Excel spreadsheet, is a program called ChView, which is a fascinating-- if slightly frustrating-- program. For a piece of free-on-the-internet software, it's really good at visualizing interstellar maps. But it isn't quite everything I'd want it to be. That's all right, the person who wrote the program wasn't doing it for me, and I think it's great. Check it out.
Anyway, will all this work come through in the actual writing? I'm not sure. I do know this-- at my first attempt to write in this setting, I tried having a mysterious artifact from a old, powerful civilization be a plot point. But I didn't know anything about said civilization, where they were, and why the artifact was left behind. I was going on the fly. Didn't work.
Now I know the neighborhood, and that makes writing about exploring it so much more fun.