What is the role of the popular vote in determining how electoral votes are won?

The electoral college is a purely representative forum. Each state is allocated a fixed number of electors (currently, equal to the number of Representatives plus Senators). How that state chooses its electors is up to the individual states. Most of them use a "winner take all" method, where the winner of the majority popular vote in the state is given ALL the state's electoral vote.

However, a few states (Maine and Nebraska) are using a plurality method, where the popular vote winner in each Representative district is awarded one electoral vote, and the winner of the state's total popular vote is given two more electoral votes.