Estimates the range that likely contains the population proportion as p̂ ± z × √(p̂(1 − p̂) ÷ n). This is what produces the margin of error quoted with opinion polls.
This turns a proportion measured in a survey into a range that plausibly contains the true proportion in the whole population. The "margin of error 3%" quoted with opinion polls comes from exactly this calculation.
Of 1000 people surveyed, 40% approve, so and , at a 95% confidence level.
The 95% interval runs from 36.96% to 43.04% — an approval rating of 40% with a margin of error of 3.0%.
The sample size you need barely depends on the size of the population. Polling 1000 people gives a margin of about 3% whether the country has 100 million people or the town has 100,000. That is the answer to the natural objection that 1000 people cannot possibly speak for a nation.
The margin is widest at , which lets pollsters state conservatively that with the error is at most 3.1%, whatever the result turns out to be.