The Electoral College is the formal body, created by Article 2, Section 1, in the Constitution, that elects the president. Each state has as many electors in the Electoral College as it has senators and representatives in Congress. When people vote in a presidential election, they are actually voting for electors pledged to vote for their candidate.
State election laws decide the method of choosing electors. Eventually, all states left the election of presidential electors to popular vote.
There is no constitutional requirement that all the electors of a state vote for a single candidate, but all states except Michigan in the 1890s and Maine and Nebraska in modern times have had a winner-take-all system: The candidate who receives a majority of the popular vote receives all the state’s electoral votes. Maine has adopted a “congressional district” system that chooses electors based on the plurality (the most votes but not necessarily a majority) in each district. This means that a candidate might win 3 rather than all 4 electoral votes if he or she loses in one of the districts. The winner of the statewide vote in Maine also receives the two “senatorial” electors.