I keep saying. The election was close because the election turned on racists and sexists who supported Trump in an extraordinary way. This is in fact a minority in the US and so it came down to where the minority lived, which is not the more populated portions of the US. Also Trump's party got a bump because the electorate tends to vote for the party out of power at the end of a two term presidency. Hence, a minority president won through our archaic electoral college.
This is all well documented and not an opinion of mine but facts gathered from very good studies.