For general background on Determining Sample Size, see the simple introduction provided by University of Florida at http://edis.ifas.ufl.edu/pd006 and, of course, the many Wikipedia entries.
For more mathmatics concerning confidence interval calculations, see the Yale course on the subject. Here is the math and standard statistics explanation.
The selection of a confidence level for an interval determines the probability that the confidence interval produced will contain the true parameter value. Common choices for the confidence level C are 0.90, 0.95, and 0.99. These levels correspond to percentages of the area of the normal density curve. For example, a 95% confidence interval covers 95% of the normal curve -- the probability of observing a value outside of this area is less than 0.05. Because the normal curve is symmetric, half of the area is in the left tail of the curve, and the other half of the area is in the right tail of the curve. As shown in the diagram below, for a confidence interval with level C, the area in each tail of the curve is equal to (1-C)/2. For a 95% confidence interval, the area in each tail is equal to 0.05/2 = 0.025.