Astronomers use an effect called parallax to measure distances to nearby stars. Parallax is the apparent displacement of an object because of a change in the observer's point of view. The video below describes how this effect can be observed in an everyday situation, as well as how it is seen and used for finding distances to stars.
Another way to see how this effect works is to hold your hand out in front of you and look at it with your left eye closed, then your right eye closed. Your hand will appear to move against the background.
This effect can be used to measure the distances to nearby stars. As the Earth orbits the Sun, a nearby star will appear to move against the more distant background stars. Astronomers can measure a star's position once, and then again 6 months later and calculate the apparent change in position. The star's apparent motion is called stellar parallax.
There is a simple relationship between a star's distance and its parallax angle:
d = 1/p
The distance d is measured in parsecs and the parallax angle p is measured in arcseconds.
This simple relationship is why many astronomers prefer to measure distances in parsecs.
Parallax angles of less than 0.01 arcsec are very difficult to measure from Earth because of the effects of the Earth's atmosphere. This limits Earth based telescopes to measuring the distances to stars about 1/0.01 or 100 parsecs away. Space based telescopes can get accuracy to 0.001, which has increased the number of stars whose distance could be measured with this method. However, most stars even in our own galaxy are much further away than 1000 parsecs, since the Milky Way is about 30,000 parsecs across. The next section describes how astronomers measure distances to more distant objects.