I presume that pollsters did their job well. There is a pattern here, they got it wrong both with Brexit and with Trump. I think bad polling was not the reason. The media, the government and academia have created an atmosphere of militant orhodox liberalism, where dissenting voices are not only silenced, but often ridiculed, doxxed, forced to resign etc. These people will choose to disappear from the polls. They will "Think as they want, but behave like others", until they are given the chance to fight back.
Thankfully, in democracies we have elections to release those tensions. And setbacks in democracies are inevitable.