There was a great joke going around near brexit, that the US and UK were in a competition to ruin their countries. The UK really pulled ahead with brexit, but the us had a trump card.
Clinton lost because Jamey Comey (Director FBI) publicly reopened her email investigation 3-weeks before election day. It was a huge deal that everyone seems to have forgotten. The polls were right up until then.