The Electoral College was established in Article II, Section I, of the United States Constitution, and was later modified by the Twelfth and Twenty-third amendments, which clarified the process.
When U.S. citizens vote for president and vice President every election cycle, ballots show the names of the presidential and vice presidential candidates, although they are actually electing a slate of "electors" that represent them in each state. The electors from every state combine to form the Electoral College.
Each state is allocated a number of electors equal to the number of its U.S. Senators (always two) plus the number of its U.S. House representatives (which may change each decade according to the size of each state's population as determined in the census).
Each political party with a candidate on the ballot designates its own set of electors for each state, matching the number of electors they appoint with the number of electoral votes allotted to the state. This usually occurs at state party conventions. Electors are typically strong and loyal supporters of their political party, but can never be a U.S. Senator or Representative.
Electors are also generally free agents, as only 29 states require electors to vote as they have pledged, and many constitutional scholars believe those requirements would not stand in a court challenge.
After the election, by statutes in 48 states and the District of Columbia, the party that wins the most votes in that state appoints all of the electors for that state. This is known as a "winner-take-all" or "unit rule" allocation of electors, which became the norm across the nation by the 1830's. Currently, the only exceptions to the unit rule are in Maine and Nebraska that allocate their electors by congressional district, plus two at-large electors awarded to the candidate who wins the state's' popular votes.
By federal statute the electors for each state are required to cast their votes in mid-December, after which the votes are sealed and sent to the president of the U.S. Senate. Though the public votes for the party as a whole, the electors cast individual votes on separate ballots for president and vice president. This has become important in several elections in which electors voted for candidates other than those to whom they were pledged.
On January 6th, following the presidential election year, the president of the U.S. Senate opens all of the sealed envelopes containing the electoral votes and reads them aloud. To be elected as president or vice president, a candidate must have an absolute majority (50%, plus one vote) of the electoral votes for that position.
A majority is never guaranteed within the Electoral College. An election with no Electoral College majority could occur in two ways; if two candidates split the total of electoral votes evenly (with 538 electoral votes as of 2009, a tie would mean a split of 269-269) or if three or more candidates receive sufficient electoral votes to deny one candidate a majority.
If no presidential candidate obtains a majority of the electoral votes, the decision is deferred to the U.S. Congress. The House of Representatives selects the president, choosing among the top three candidates, and the Senate selects the vice president, choosing between the top two candidates. In the House selection, each state delegation receives only one vote and an absolute majority of the states (26) is required to elect the president. (In this situation, Washington, D.C. would lose the voting power given to it by the 23rd Amendment since it does not have the same congressional representation given to the states).
However, a majority winner is not guaranteed in the Congress either. The states could feasibly split their votes equally between 2 candidates (25 state votes each) or the votes could be split between three candidates in such a way that no candidate receives a majority.
Also, since every state only gets one vote, the representatives from each state must come to a decision on which candidate to support in the House. A state with an equal number of representatives supporting the competing parties would not be able to cast its vote unless one representative agreed to vote for the opposing side.
If a majority is not reached (for president) within the House by January 20 (the day the president and vice president are sworn in), the elected vice president serves as acting president until the House is able to make a decision. If the vice president has not been elected either, the sitting Speaker of the House serves as acting president until the Congress is able to make a decision. If a president has been selected but no vice president has been selected by January 20, the president then appoints the vice president, pending approval by Congress.