Most boaters already should know what Triangulation is, it's a way to find your position by taking a bearing on two or more land objects whose positions are known. Then, all you have to do is draw lines on your chart with reciprocal bearings from the landmarks out into the water in the direction of your boat, and where the lines cross, that's where you should be.
Well, the same type of Triangulation can be done out in the open ocean when you're out of sight of land, but instead of using known visible landmarks, you can use the known the sun (or other celestial body) for that instant of time. This is what is known as the celestial body's "GP," or Geographical Position. To find out where it is, you draw an imaginary line from the center of the earth all the way up to the celestial body. Where that line comes through the surface of the earth, that's the celestial body's GP, and it is an exact position. Of course it is constantly changing, but there are books available (the Nautical Almanac, for example) that list the GP of the Sun, Moon, 4 Planets and 57 Navigational Stars for each second of the year. these are the bodies most commonly used for Celestial Navigation. So, if you have an accurate timepiece, you can always locate the celestial body's GP.
Once you know the GP of the celestial body you want to use as a reference point, your next problem is to find out exactly how far away you are from it, and what your bearing to it is, then you will have the two elements necessary for any navigational fix.
Distance and Direction
To determine your distance from the GP on the surface of the earth, we use an instrument called a Sextant. What the sextant does is measuring the angle from our vertical (mast, or imaginary line from the center of the earth, up through our boat) to the celestial body, but since it's almost impossible to measure that angle on a moving vessel under way, we get that angle instead by measuring the height of the celestial body up from the horizon and then subtracting that angle from 90 degrees, which will then give us the angle that the body is from our vertical. This is a neat little trick to find the angle that we're really looking for.
Of course, there are several minor corrections to take into account once you've used the sextant to measure the above mentioned angle. For instance, there's the portion of the body you were measuring, if it's the Sun, were you using the upper or lower part of the Sun? Depending on which, you will make what is called a "Limb" correction and there is a table for that in the Nautical Almanac. There will also be corrections for "Dip" (your height above sea level when taking the sextant shot), "Index," etc.
Once you know the angle of the celestial body from the vertical of your boat, then you also know the distance in nautcial miles that you are away from the celestial body's GP. The reason you now have that distance is because the surface of the earth is divided into the same number of degrees as any circle, 360. Each one of those degrees is then divided into 60 equal portions, each one called a nautical mile. So, if you know the angle between your boat's vertical and the celestial body's GP, then you also know that distance in nautical miles on the surface of the earth, it's 60 times your corrected angle measurement.
Using the Nautical Almanace to determine the GP of the body, and then your sextant to determine your distance from the body, you can then plot a circle on a chart with the body in the center and your distance from it as the radius. This is appropriately called a "Circle of Position," and you boat will be somewhere on the circle.
If you are using the Sun at your Local Apparent Noon, then there is a way to know your Latitude and Longitude with only one single sextant shot. If you are using other celestial bodies, or making successive shots of the same body over a period of a couple of hours, there are tables you can use to do what coastal piloting calls a "running fix."
There is also a way to determine your direction to the celestial body's GP (the Azimuth), which will then give you the Range and Bearing.
Remember, GPS and electronics are great as long as the system is up and running and your batteries hold out, but there is nothing like having a back-up that will never fail you, and that back-up is Celestial Navigation.