This possibility is part of the election process set by the main part of the US Constitution and is not due to any amendment.
Electoral College
congress
The president of the United States is elected to office by the electoral college as opposed to popular vote. Any candidate who wins the presidency has to have a majority of at least 270 electoral votes. If no candidate receives a majority, the election will need to be decided via a procedure outlined in the Twelfth Amendment of the Constitution.
The House of Representatives elected the president. The 12th Amendment to the Constitution (1803) requires the House to "immediately" elect a president in the event no candidate gets an electoral majority. There were 4 candidates in the 1824 election and none received a majority of electoral votes, requiring the House to make the decision as to who would be President of the US.
The Twelfth Amendment to the United States Constitutionprovides the procedure for electing the President and Vice President. The best example of its use is the recent election of 2016, where the Republican candidate lost the popular vote, but was elected President by the Electoral College.
270 out of 538.
The House selects the president out of the top 3 candidate with votes.
A presidential election is won by the candidate who receives a majority of the electoral votes in the U.S. Electoral College.
If neither candidate receives 270 electoral votes in the presidential election, the decision goes to the House of Representatives. They will then vote to choose the president from the top three candidates with the most electoral votes.
If a candidate does not receive 270 electoral votes in the presidential election, the decision goes to the House of Representatives to choose the president from the top three candidates with the most electoral votes.
The 12th Amendment reorganized the system for electing the US President.
If no candidate receives a majority of electoral votes, the Twelfth Amendment of the United States Constitution provides that the U.S. House of Representatives will select the president, with each of the fifty state delegations casting one vote, and the U.S. Senate will select the vice-president.