I can tell you why the pollsters got it wrong.  They actually didn't, since Hillary won by two million votes.  As statistician guru Nate Silver said there were too many undecideds to make a safe prediction.  As a canvaser, I can tell you that many of the people who claimed to be undecided weren't really.  Often their body language did not match the words coming out of their mouth.  They were voting for Trump, but they were too embarrassed to admit they were voting for an openly racist candidate.