Answer :

In order to win a presidential election the candidate must get a majority of the vot es of the Electoral College, which in turn is determined in the popular election. As different states have different number of electors, it can happen that the president gets a majority of the electors' votes but not the majority of  popular votes.