The electoral college officially elects the President of the United States. Though American citizens registered to vote cast ballots for a particular Presidential candidate, they are really voting for a group of electors from their state.
The number of electors from each state is based on the number of representatives and senators the state has in Congress. A vote for a candidate is actually a vote for his electors. The electors from each state vote for the candidate who won the majority vote in the state. Though some states do not require the electors to follow the popular vote, most do. A Presidential candidate must have 270 electoral votes to win the election. Some Presidents win the election by the electoral college who did not win the popular vote.