Voting for "President"- While it may list a President and Vice President on the ballot, voters are actually voting for higher up voters, called electors, who vote for the president most of their voters voted for (lots of votes.) These electors make up the Electoral College.
Counting It Up- The president the majority (51%) of a states population "votes" for wins all of the electors of that state. The electors from every state are then counted up, and the president that got the majority of the votes from the electors wins.
Number of Electors- the amount of electors a state gets is equal to the amount of representatives that state has in both the House of Representatives, and the Senate. There are 538 electors in total.