The margin of error takes into account the possibility that your sample wasn’t representative of the population you’re trying to test.
Say the state of Ohiowa has 1,000,000 voters. If you were perfectly omniscient, you would know that on election day 501,000 of them will vote for the Dempublican, while 499,000 will vote for the Republicrat. Since you aren’t perfectly omniscient, you poll a random sample of Ohiowans. The margin of error is to take into account the possibility that, just by sheer bad luck, you happen to draw the names of 501 Republicrats and 499 Dempublicans out of the hat. Generally, it’s expressed as something like “50.1% Dempublican to 49.9% Republicrat, and we’re 95% sure that the actual population is within plus or minus 2% of that”. Note that this means there’s a 5% chance that you’re even further off than the plus or minus 2% number you gave. Note also that if you make the plus or minus number larger, you can get really high degrees of confidence. We can say with great confidence–99.999…%–that Ralph Nader will not make a stunning upset and be elected President of the United States next Tuesday, and that neither Bush nor Kerry will take 75% of the national popular vote. Of course, those predictions aren’t very useful either. You trade accuracy for precision. “It will rain in Iowa sometime in November” is almost certainly accurate, but not terribly precise; “It will rain in downtown Cedar Rapids after lunchtime next Wednesday” is very precise, but has a very good chance of being completely inaccurate.
Also, the “margin of error” is taking into account random chance, not a flawed survey. (“Are you voting for our noble patriotic Dempublican incumbent Senator, or for his weaseling, freedom-hating, wife-beating, puppy-killing Republicrat opponent?”) Flaws can be more subtle than leading questions (and bad question design can be a lot more subtle than that, of course). For example, if you pick your sample by going through the phone book, you will miss people with unlisted numbers. Perhaps more Republicrats have unlisted numbers, because that party attracts rich people who don’t like to be bothered at home, and can afford to pay for an unlisted number. Or maybe single women are more likely to be Dempublicans, and also more likely to have unlisted numbers to stave off creeps and stalkers. (In practice, modern pollsters use automated dialing systems, and call people with unlisted numbers as well. One factor which no one really knows if it will have any affect on this round of polls are the growing number of people with cell phones only but no land lines, who don’t get called.)
There’s a whole lot more to poll-taking, which makes it in practice more of an art than a science. (How do you determine who’s a “likely” voter, anyway? How do you control your sample so that it truly represents the population at large?)