The AVERAGE of the NATIONAL polls...the last one on realclearpolitics.com has Obama about .7 over Romney. Obama ended up being about 2.5% over Romney. So it was off, but it had the winner right, and it wasn't off by that much.
The NATIONAL polls looked at by fivethirtyeight.com came closer on the Monday before the election. It showed Obama with a 1.6% lead.
The average of the national polls reflects the popular vote.
It's harder to get polls REALLY close, when the race is close. Just a few people not showing up to vote, or changing their minds, can make a difference. That's where the margin of error comes into play.
When you look at the polls for the BATTLEGROUND STATES, Obama won those where he was ahead in those battleground state polls (which was almost all of them):
CO - Obama ahead 1.9% (Obama won this state)
FL - Romney ahead .7% (Obama won this state 50% to 49%)
IA - Obama 2.6% (Obama won)
NC - Romney 1.9% (Romney won)
VA - Obama 1.3% (Obama won)
OH - obama 3% (Obama won)
Not competitive states, but which Romney THOUGHT were competitive:
PA - Obama 4.6% (Obama won)
WISCONSIN - Obama 4.3% (Obama won)
Moreover, Obama wasn't only leading in almost all the battleground states, he had been leading in them for some time. It was a consistent lead.
So the polls were very accurate, for a close race.