The President of the Senate shall, in the presence of the Senate and House of Representatives, open all the certificates and the votes shall then be counted.
The person having the greatest Number of votes for President, shall be the President, if such number be a majority of the whole number of Electors appointed; and if no person have such majority, then from the persons having the highest numbers not exceeding three on the list of those voted for as President, the House of Representatives shall choose immediately, by ballot, the President. But in choosing the President, the votes shall be taken by states, the representation from each state having one vote; a quorum for this purpose shall consist of a member or members from two-thirds of the states, and a majority of all the states shall be necessary to a choice. And if the House of Representatives shall not choose a President whenever the right of choice shall devolve upon them, before the fourth day of March next following, then the Vice-President shall act as President, as in the case of the death or other constitutional disability of the President.
The person having the greatest number of votes as Vice-President, shall be the Vice-President, if such number be a majority of the whole number of Electors appointed, and if no person have a majority, then from the two highest numbers on the list, the Senate shall choose the Vice-President; a quorum for the purpose shall consist of two-thirds of the whole number of Senators, and a majority of the whole number shall be necessary to a choice. But no person constitutionally ineligible to the office of President shall be eligible to that of Vice-President of the United States."
The twelfth amendment redefines how the vice president is appointed. This is can be, as history has shown, a very important amendment to have around.
This is a brief history of our twelfth...
Representative James Madison, who was so instrumental in the creation of the Constitution in the first place, drafted a bill of rights. Though he originally opposed the idea, by the time he ran for a seat in the House, he used the creation of a bill as part of his campaign. He introduced the bill into the House, which debated it at length and approved 17 articles of amendment. The Senate took up the bill and reduced the number to 12, by combining some and rejecting others. The House accepted the Senate's changes, voting on September 24th and 25th, 1789; twelve articles of amendment were sent to the states for ratification.
This video explains the twelfth amendment.