The 12th Amendment to the U.S. Constitution (which superseded a large section of Article II, Section 1) suggests says that the ballots of the electors in the several states having marked their ballots for President and Vice President shall
"transmit sealed to the seat of the government of the United States, directed to the President of the Senate; -- 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."
On or about January 6, 2013 (probably January 7th or 8th as the 6th is on a Sunday) that counting will take place and Barack Obama will be declared President and Joe Biden will be declared Vice President.
That part we know all too well. What we don't pay much attention to is the original (and un-amended) language of Article II, Section 1 which states:
"Each State shall appoint, in such Manner as the Legislature thereof may direct, a Number of Electors, equal to the whole Number of Senators and Representatives to which the State may be entitled in the Congress"
Note, the Constitution does not prescribe that the candidate with the most votes in a given state be granted all of the Electors. It leaves the "Manner" of selection up to the State Legislatures.
Indeed, if the State Legislature of Upper Iguana determined that its Governor should choose the electors, then a popular vote would be unnecessary as he (or she) could pick electors for what ever candidate he (or she) desires.
Or, Upper Iguanians might decide to let the Legislators themselves choose the Electors.
Granted, either of these is unlikely in any real state except for Illinois, but it would be possible.
The current system is well known: 48 states and the District of Columbia award all of a states' Electors to the candidate that wins the majority of the votes in that state.
The other two states, Nebraska and Maine have a better plan: They award Electors by Congressional District. Nebraska has three Congressional Districts; Maine has two.
The winner in each CD gets that Elector and the candidate with the most votes statewide gets the Electors awarded for the two Senate seats.