Neither candidate was campaigning for a popular vote, they were both campaigning to win the electoral college. Which Trump did because ~63,000,000 Americans decided, purely of their own free will, that he was the better candidate. No matter how much you try to retroactively gerrymander the outcome, both candidates were playing on a level playing field, one of them won and one of them lost. It’s really a testament to democracy that an outsider candidate can prevail over the amount of establishment support Hillary had.