I know, I know... I've heard this from all my friends and readers: How is it possible that Donald Trump would get elected President of the Greatest Nation in the World? (OK, the part about the Greatest Nation in the World is my addition.)
There is a technical reason: despite getting more than two million votes more than Donald Trump, Hillary Clinton didn't have her votes distributed in a geographically diverse enough way. America is a federation, and as such the constituent states have a say in government. In theory, the winner of the presidential election would need a majority of both states and people, but that could easily lead to a situation where (like in this year's case) the majority of the states doesn't want the same as the majority of the people.
To make elections easier and faster, the Constitution settled on a numerical formula that is a brilliant compromise: each state gets as many votes in the election of the president as it has Senators and Members of the House. The Senate is composed of two Senators per state (so that part translates to one vote per state), while each state has a number of Members of the House proportional to its population (so theoretically, that should translate to a majority of the people).
The Constitution settled on another odd compromise: each state would send voters (called electors) to Washington, and these electors decide who's going to be president and who vice-president. Over time, the electors were specifically selected for allegiance to one particular candidate, and some states even punish those electors that don't vote for the presidential candidate for whom they were sent.
So, it could happen that a narrow win in three states sent Donald Trump into the White House, while he didn't have a majority of the vote. The formula chosen favors Republicans in general, because central states were drawn to be of manageable size, and so a lot of the rural states in the middle of the country have small to tiny populations. Wyoming, for instance (a gorgeous place!) has only 1.5% of the population of the most populous state, California. In fact, the USA has 31 cities that have more inhabitants than all of Wyoming, but have none of the electors (3) that Wyoming has.
After this civics lesson, the political angle. Hillary Clinton was reviled. Part of it was that the media wanted to make the contest more interesting by tearing down the front runner. Part of it was blatant misogyny. Part of it seems to have been manipulation by foreign powers, especially Russia, which seems to have fed information to WikiLeaks. it didn't help that the founder of WikiLeaks had an ax to grind with Ms Clinton - maybe a remnant of the days he had to hide in the Ecuadorian embassy in London.