When U.S. citizens vote in a presidential election, they are actually casting ballots for a designated elector from that candidate's party in their state, who will then cast a vote as part of the Electoral College. Electors are party representatives who cast votes in their respective states in December. Electors have chosen the president since the country's founding, and the term Electoral College has been used since the early 1800s. The Electoral College was written into federal law in 1845. To learn more about the history of the Electoral College, visit this National Archives website.
It takes two hundred and seventy electoral votes to win the presidency. The number of electors in each state is equal to the number of senators and members of congress it has (which is based on each state's population). In forty-eight states and the District of Columbia, the winner of the popular vote gets all of the state's electoral votes (this is known as the unit rule). Maine and Nebraksa are two exceptions, where the electoral votes can be split between candidates. So, one can think of the presidential election as fifty-one independent elections, one within each state. Because of this state-based system, it is possible that the candidate who wins the popular vote throughout the nation could lose the presidency, as was the case in the 2000 election. You can hover over the states in the map to see electoral and popular voting statistics for the 2004 election.