The first part of the amendment says: "The Electors shall meet in their respective states and vote by ballot for President and Vice-President, one of whom, at least, shall not be an inhabitant of the same state with themselves; they shall name in their ballots the person voted for as President, and in distinct ballots the person voted for as Vice-President, and they shall make distinct lists of all persons voted for as President, and of all persons voted for as Vice-President, and of the number of votes for each, which lists they shall sign and certify, and transmit sealed to the seat of the government of the United States, directed to the President of the Senate..."
Under the original system, the electors voted for two candidates without specifying which was for president and which vice president. Whomever received the most votes of the grand total became president, provided he had a majority, and whomever was second became vice president. But in 1800, both Jefferson and Burr received 71 electoral votes, presumably when one of the Democratic-Republican electors forgot not to vote for Burr, as was the plan, since ostensibly Jefferson and Burr were on the same side.
The passage of the 12th amendment didn't prevent the selection of the president by the House one more time, in 1824, but that was because of a four-way race. Andrew Jackson actually received more electoral votes, 99 to John Quincy Adam's 84, but it wasn't a majority for Jackson, and the House picked Adams. (Jackson, of course, came back in four years to stomp on Adams, 178 to 83.)