The margin of error of an opinion poll is often quoted as plus or minus 3%. This is a good approximation, but there is an exact formula that can also be used.
If an opinion poll sampled N people, and found a proportion p of support for a party, then the margin of error on that proportion is 1.96*Sqrt[p*(1-p)/N]. For instance if a poll of 5000 people estimates a party at 30% support, then the margin of error is 1.96*Sqrt[0.3*0.7/5000]=1.3%. Another example is a poll of 1000 people, and a party at 50% support, where the error is 3.1%, which is the famous "3%" margin.
This margin is not an absolute guarantee but a confidence limit. It should be expected that for 19 polls out of 20 the true levels will lie within the margin of error (95% confidence level).
Pollsters try to cope with these problems by various means, including quota sampling. The sample is weighed to match some key national averages, such as the proportion of people who are: owner-occupiers, council tenants, members of trade unions, in a particular social class, and so on.
Quota-sampling aims to reduce variance, but in can introduce biases of its own, and was blamed in part for the polls' failure in 1992. The track record of the polls since 1992 has been better, but not perfect.