If a random star were to appear in our skies, and you asked an astronomer how far away it was, they couldn't give you an immediate answer. One thing I always took for granted was how these scientists were able to map the night sky, give us a detailed perspective on what was out there in the final frontier. Some of these methods (like how to determine how far away a star is) can be somewhat interesting.
Using the right math, many people could triangulate the position of an object, as long there are a few known variables and objects in the field of view. However, on Earth, to calculate how far away a star is, through distances spanning hundreds of light years, it is very difficult, because the angles which are being dealt with are very small, and hence prone to error. However, given a 6-month span, our orbit around the sun gives us a much better distance to do this calculation with. Knowing such things as the precise time, radius of orbit around the sun, and the positions of other stars in the sky, we can calculate relatively well star distances.
However, this only really works up to 400 light years (thanks, HowStuffWorks), because, while the 150 million kilometer difference in our position is a lot, with a star 10 light years away (still fairly close), the difference in angle is still miniscule, clocking in at just a few hundred-thousandths of a degree. Which is to says, that while the distances we get aren't perfectly accurate, for what they're worth they are pretty dang good.
There are different, more spectroscopic and more accurate methods of determining a star's distance, that rely on standard gathered data for stars that work at all distances. But before this data was collected, really the only way to gather this data was through triangulation. That, simply put, means that olden astronomers, those like Galileo, were the ones doing all this tricky math. Cool stuff.