Congress and the Electoral College
The idea behind the electoral college is pretty much the same idea as the two houses of Congress. It is an attempt to balance states with people versus states without.
Congress
In the case of Congress the House of Representatives has different numbers of representatives for each state, determined by population. Thus this house represents the will of the majority of people.
The other house of Congress, the Senate, has the same two senators for each state. This allows states without population to have equal influence. Two side notes about the Senate are relevant.
First, the Senate is the "upper" house and has arguably more power. The Senate approves treaties and confirms Supreme Court and federal judges, flag officers, and cabinet members. They also conduct impeachment trials.
Second, Senators were originally elected by the legislatures of states, not directly by the people. The 17th Amendment changed that.
Unfortunately this means that many of the most important decisions made about our country are not really made by anything like popular vote. The upper house can at times override the will of the majority of American voters due to the way it is constructed and the power it wields.
Electoral College
A similar thing happens with the Electoral College. While the number of electors for each state varies according to population, most states require all electors to vote for the candidate that wins the most electors in the state. This can, and has, resulted in cases where the Electoral College has elected candidates that received less actual votes overall.
If the Electoral College doesn't have a majority vote for any candidate then the House of Representatives votes for President from among the top three candidates. There is one vote per state, so again the majority doesn't really get counted. If there is no majority for Vice President the same thing happens in the Senate, choosing from amount the top two candidates. This has only happened twice, both times in the early 19th Century.
Criticism
Many people argue that the Electoral College should be replaced by a simple majority vote. After all, are we a democracy or not? But perhaps this goes too far, disenfranchising the states with smaller populations.
Instead, perhaps we should look at these cases as indications that the election has not found a candidate acceptable to the people and the states without people. In this case the election has failed and some other course of action should be followed in order to avoid a divisive term of office.
Do Over
I would propose that in situations where there is no clear winner or the Electoral College disagrees with the majority vote that we should retain our current leadership for another year and hold another election. My reasoning is that the people have not spoken with a unified voice and failing that voice we should not proceed with the results of the election.
This would require a Constitutional Amendment. I doubt such a change will ever happen. Personally I think that something should be done but then I'm probably just a sore loser.