How one gets elected president is provided for in the Constitution Article II as amended.
In the simplest situation one major party candidate gets a majority of electoral college votes and the other major party candidate gets a smaller number of electoral votes and none of the other candidates get any electoral votes.
Getting a majority of electoral votes gets you elected president even if sometimes the candidate with the most electoral votes is not the one with the most popular votes as happened with Bush v. Gore in 2000.
When a third party or independent candidate who appears to have substantial support joins the two major party candidates on the November ballot, the election outcome may involve other scenarios. First of all, it is unlikely that either major party candidate will receive a majority of the popular vote.
In 1992, no candidate had a majority of popular support, but a major party candidate received a majority of the electoral votes. Bill Clinton received 43.01 per cent of the popular vote and 370 electoral college votes and George H. W. Bush received 37.45 per cent of the popular vote and 168 electoral college votes. In that election the third-party candidate, Ross Perot received 18.91 per cent of the popular vote, but no electoral college votes.
In 1968, although there was a third party candidate who received electoral college votes, the winning candidate, Richard Nixon, had a substantial majority of electoral votes. The results were:
Nixon: 301 Electoral College; 43.4 per cent popular vote.
Humphrey: 191 Electoral College; 42.7 per cent popular vote.
Wallace: 46 Electoral College; 8.4 per cent popular vote.
Now consider the situation if, with a popular third party or independent candidate, no candidate gets a majority of the electoral college vote.
According to Article II of the Constitution and Amendment 12, if no candidate receives a majority of the electoral college votes for president, the election is decided by House of Representatives among the three candidates receiving the greatest number of electoral college votes; the House votes by state, one vote per state, with a majority of all the states needed to elect.
So the result can be that the president can be elected without a majority of popular vote and without a majority of electoral college vote.