Fundamentally, there are two kinds of error, systematic bias and simply random.
If you draw 500 people from a population of 1,000,000 where ~2000 believe the moon is made of cheese and the US government has been hiding that, you would expect to find one respondent who believes the moon is made of cheese. If you happen to draw none or 3, that is a form of polling error, which is what produces the confidence intervals we see. Now, it is possible that you could draw 250, massively skewing your perception of the underlying population, but the probabilities are exceedingly low. That sort of error is just in there.
Now, where systemic bias comes in is if I take that sample of 500 at a convention for conspiracy theorists.
For pollsters, the problem comes in when they attempt to draw a random sample in good faith, but for some reason the sample is not as random as they would hope. But there is very little they can do to correct that.
There are a couple of theories around why polls have struggled (though it is important to note they quite simply have not struggled nearly as much as the popular wisdom would have it). Sample bias around the emergence of cell phones (landlines used to be the standard, which itself produced a known skew), and with Trump an additional factor has been posited - that some of his supporters actually deliberately misrepresent their preferences in some poll mechanisms.