The 12th Amendment was passed so that the president and the vice president of the United States would be from the same political party. Prior to the ratification of the 12th Amendment in 1804, the person who received the most electoral votes was made president, and the person who received the second-most electoral votes was made vice president, regardless of whether or not the two belonged to the same party.
The 12th Amendment extended the criteria required to become president to the vice president. Like presidents, vice presidents must be natural-born citizens who are at least 35 years old and who have lived in the country for the last 14 years.
The amendment has a clause suggesting that the president and the vice president should be from different states. Being from the same state is not banned, but the amendment states that, if two candidates are from the same state, the electors from that state cannot vote for them.
If no candidate receives the majority of electoral college votes, the 12th Amendment states that the House of Representatives should vote for the president from the top three candidates. However, each representative does not get an individual vote. Rather, each state gets a vote.