An overview of how it works:
- Measure the amount of sugar dissolved in the wort before it begins fermenting. (A)
- Measure the amount of sugar remaining in the solution when the beer has completed fermentation. (B)
- Remove the decimal points and take the difference of these two measurements (A - B = C). Divide C by the constant 7.36 to get the alcohol by volume.
C/7.36 = % alcohol by volume.
That's really all there is to it. The measurements in steps one and two are the "specific gravity" of the liquid. Specific gravity is a ratio of the density of one substance to the density of water. Substances with gravity greater than 1.000 are denser than water while substances with a gravity less than 1.000 are less dense than water.
The measurements are taken with a device called a "hydrometer". A sample of beer is taken in a small tube (similar to a graduated cylinder). The hydrometer is a glass tube with a bulb on the bottom. The device is calibrated to measure gravity in part due to a chunk of lead inside the bottom of the glass bulb. The hydrometer is allowed to float in the beer. When the hydrometer stabilizes, graduations on the glass tube indicate the gravity readings which vary depending on how high or low the hydrometer comes to rest in the liquid.
The measurement in step 1(A) is often called the "Original Gravity"(OG) or "Initial Gravity". For most beer this can be as low as 1.035 (Berliner Weisse beer) or as high as 1.120+ (in the case of barley wines).
The measurement in step 2(B) is termed the "Final Gravity"(FG). For most beer this can be as low as 1.000 (some sour ales) or higher than 1.030 (barley wines, scotch ales, imperial stouts, etc.)
There are various methods for calculating alcohol based on the two measurements, and none are 100% correct. I chose this method because it's the easiest to estimate off hand. The beer becomes less dense as it ferments. The sugars are processed by yeast into carbon dioxide and alcohol. The CO2 gas bubbles out of the fermenter while the alcohol (which is less-dense than water) remains. The more sugar that remains in the beer (the higher the FG), the sweeter and thicker it will taste. The lower the FG, the drier and thinner the beer will taste.
A couple weeks ago I brewed a Russian Imperial Stout. I measured the OG to be 1.106. The beer has now finished fermenting, at left you can see the hydrometer floating in the fermented beer. The FG looks to be about 1.033.
Using (OG - FG)/7.36 we get: