The polls were less wrong than the media would have us believe, as all of the major polls generally fell within "the margin of error." As Nate Silver of fivethirtyeight.com put it, the error was "modest," not "massive."

Let us compare the latest polling results before the election to the actual election results nationwide, for Pennsylvania and for North Carolina. I include North Carolina because it was arguably the most contested state. Clinton visited North Carolina 10 times since June. Trump, 12 times.

For my analysis, I use the polling averages from realclearpolitics.com. Pollsters always report the margin of error for their polls, which is based on the size of their sample. This is the range of possible difference in the percentages found in the sample to the actual percentages in the population of likely voters. The average margin of error for the polls included by realclearpolitics.com varies. It may be different for national averages and the state averages.

The popular vote totals nationwide stand at 62,996,001 for Trump and 63,655,175 for Clinton. That is virtually a "dead heat," right at 50 percent for each candidate. Trump won 306 electoral votes and Clinton won 232 electoral votes. The realclearpolitics average was 46.8 percent for Clinton and 43.6 percent for Trump. The margin of error for the national polls was plus or minus 3 percent. Therefore, the polls were barely outside the margin of error for both Clinton and Trump.

The popular vote total in Pennsylvania was 49 percent for Trump and 48 percent for Clinton. The polling average for Pennsylvania was 44.3 percent for Trump and 46.2 percent for Clinton. The margin of error for the Pennsylvania polls was plus or minus 4 percent. This is within the margin of error for Clinton, although not for Trump. It was barely outside the margin of error for him.

The popular vote total in North Carolina was 51 percent for Trump and 47 percent for Clinton. The polling average for North Carolina was 46.5 percent for Trump and 45.5 percent for Clinton. The margin of error for the North Carolina polls was plus or minus 3.5 percent. Still within the margin of error for Clinton, and again barely outside the margin of error for Trump.

In all three instances, it appears that undecided voters and those having expressed a preference for Libertarian Gary Johnson or the Green Party's Jill Stein "broke" to Trump late. For example, the vote total for Clinton and Trump nationwide was about 95 percent, while the polls were only showing it at about 90 percent.

So, what else is going on here? Voter turnout is the percentage of the eligible electorate that shows up at the polls. Nationwide, it was about 58 percent, which is lower than it was in 2008 and 2012. Low turnout typically benefits Republicans. Those who are least likely to vote - the young and minorities - vote Democrat if they do vote.

Exit polling showed that Trump got 56 percent of the 45-plus age group and 70 percent of the white vote. Turnout in Pennsylvania was 61 percent. Trump got 60 percent of the 45-plus age group and a stunning 81 percent of the white vote. In North Carolina, turnout was high by historical standards, at 65 percent. Trump got 56 percent of the 45-plus age group and 70 percent of the white vote. This suggests that high turnout in competitive states may have benefited Trump. He may have been bringing folks into the electorate who were not previous voters.

In addition, the "Bradley Effect" was probably in play. Los Angeles Mayor Tom Bradley, an African-American, lost the 1982 race for governor of California, even though he was ahead in the polls. This is referred to among pollsters as the "social desirability bias." Some respondents may have indicated they were going to vote for Bradley, even though they did not intend to, because they did not want to appear to be racially biased.

The polls may have underestimated Trump's support because respondents may have believed it was "politically incorrect" to say they are going to vote for Trump.

Thus, three factors may explain the modest error in the polls - turnout, late breaking to Trump and the Bradley Effect.

Len Champney is professor of political science at the University of Scranton.