Most polls heading into the Nov. 8 presidential election predicted Hillary Clinton would win the presidency. Two weeks before people lined up to vote, famed poll aggregator Nate Silver at the FiveThirtyEight website put her odds of winning at up to 85 percent. When he later gave Trump a 35 percent chance of winning a few days before the election, the adjustment was criticized by liberal pundits.

Yet most polls clearly got it wrong, leaving a triumphant Donald Trump seemingly clairvoyant in his repeated pre-election, mid-scandal claims the odds were actually in his favor.

Even with a steady downward trend from a mid-October double-digit national lead caused in part by the email scandal, Clinton still appeared to have an edge in the race at the end. The day before the election, a CBS News poll suggested Clinton had a four-point lead nationally, 45 percent to Trump’s 41 percent.

Get Breaking News Delivered to Your Inbox

But polling is still more art than science, relying on educated guesses about demographic groups, voter turnout, and positions on issues, and margins of error are overlooked by just reading the headlines of polls.

Another problem is that national polls don’t reflect the Electoral College.

Ask Al Gore about this: he earned about 500,000 more votes nationally than George W. Bush in 2000 but lost anyway because he didn’t win in the right states.

When all the votes are counted, Clinton may end up suffering Gore’s fate -- she currently has a slim popular vote lead of a couple hundred thousand electoral votes. Clinton could walk away from this election with the support of a plurality of voting Americans, but a resounding Electoral College defeat.

In one of CBS News’ final polls before this election, this result appeared possible. Projections showed Ohio and Florida as tied after Clinton had enjoyed leads in those states, which have long had tremendous sway over the outcomes of presidential elections with their large number of electors.

Other polls focusing on individual states just before the election showed Trump making huge headway in states Obama won in 2012 -- such as North Carolina -- as well as deep inroads in Democratic strongholds like Michigan and Wisconsin, which haven’t been won by a Republican in decades.

So if people had looked at individual battleground states and their polls rather than the national polls, the picture for Clinton would have appeared far from rosy just before Nov. 8.

And none of that takes into account the educated guessing that goes into election polling.

As the Economist points out: “Every survey result is made up of a combination of two variables: the demographic composition of the electorate, and how each group is expected to vote. Because some groups—say, young Hispanic men—are far less likely to respond than others (old white women, for example), pollsters typically weight the answers they receive to match their projections of what the electorate will look like.

“Polling errors can stem either from getting an unrepresentative sample of respondents within each group, or from incorrectly predicting how many of each type of voter will show up.”

This problem leads to uneven election forecasting and the possibility that poll headline writers in tight races can easily get it wrong. John Heilemann, Bloomberg Politics editor, told CBSN that means that “polling is broken, in a profound, deep way.”

In the case of Trump, we now know one of the key reasons why he won: non-college educated white voters, which represents a massive demographic in most of America, and especially in most key battleground states.

Their enthusiasm for the Republican candidate appears to have driven them to the voting booth in a way most pollsters simply failed to predict -- the unprecedented crowds at rallies, the people who drove long distances and waited for hours and hours to see him speak, the theory went, would not necessarily translate into votes at the ballot box. In hindsight, it seems obvious that this was flawed reasoning. Those Americans came out in record numbers to vote for Trump.

In addition to non-college educated white voters, white voters with a college degree also went for the Republican candidate in greater numbers than polls predicted. Heilemann said this is probably due to many of them being “embarrassed” to admit publicly they supported Trump.

So while it appeared that Trump’s divisive rhetoric during the campaign was turning away large segments of Americans in droves, it was at the same time firing up the passions of a sizable demographic in the right states to produce one of the most stunning political upsets in history.