For Close Objects
For objects up to around a few hundred light years, we can use parallax shift. The technique relies on some simple geometry, and the smaller the parallax shift, the further away the object is. The principal of Parallax can easily be demonstrated by holding your finger up at arm's length. Close one eye, then the other and notice how your finger appears to move in relation to the background. This occurs because each eye sees a slightly different view because they are separated by a few inches.
If you measure the distance between your eyes and the distance your finger appears to move, then you can calculate the length of your arm.
Parallax can be calculated using this formula:

Equation 10 - Distance Calculation using Parallax
Where the distance d is measured in parsecs and the parallax angle p or theta is measured in arcseconds.
A parsec is the distance at which 1 AU subtends 1 arcsecond. So an object located at 1pc would, by definition, have a parallax of 1 arcsecond.
After a few hundred light years distance, parallax shift is so small it cannot be recorded, which makes this technique ineffective.
For Far Objects
Beyond 100 light years, but within our own galaxy, we can use a technique called distance modulus. Using the distance modulus it is possible to establish a relationship between the absolute magnitude of a star, its apparent magnitude, and its distance. Distance modulus can be obtained by combining the definition of absolute magnitude with an expression for the inverse square law and Pogson's relation.

Equation 25 - Distance Modulus
Distance modulus calculations are covered in more detail when we look at apparent magnitude and absolute magnitude.
For Very Far Objects (Another Galaxy)
For objects outside our galaxy, we can use the unique properties of a Cepheid variable star. These stars vary in brightness over time, in a frequency that is exactly in ratio to its apparent brightness, thus we can measure its frequency and its brightness and compute how far away it is using distance modulus. Every galaxy has a bunch of Cepheid variables, so its quite easy to map fairly accurate distances of all the galaxies we can see.