Unlike in most elections, the person who becomes president is not necessarily the candidate who wins the most votes on Election Day. Instead, the election of the president of the United States it is a two-step process.
First, voters cast ballots on Election Day in each state. In nearly every state, the candidate who gets the most votes wins the "electoral votes" for that state, and gets that number of voters (or "electors") in the "Electoral College."
Second, the "electors" from each of the 50 states gather in December and they vote for president. The person who receives a majority of votes from the "Electoral College" becomes President.
How exactly does this work? Under the "Electoral College" system, each state is assigned a certain number of "votes". There are a total of 538 electoral votes, and the number of votes each state receives is proportional to its size --- the bigger the state's population the more "votes" it gets. The formula for determining the number of votes for each state is simple: each state gets two votes for its two US Senators, and then one more additional vote for each member it has in the House of Representatives. For California, this means we get 55 votes (2 senators and 53 members of the House of Representatives) --- the most of any state.
On or before October 1 of the presidential election year, each party's nominee must file a list containing the names, addresses, and telephone numbers of the 55 electors pledges to him/her. Each party determines its own method for selecting electors.
In the Democratic Party, each congressional nominee and each US Senate nominee (determined by the last two elections) designates one elector. Elections Code § 7100
In the Republican Party, the nominees for Governor, Lt. Governor, Treasurer, Controller, Attorney General, Secretary of State, U.S. Senate at the last two elections, Assembly Republican leader, Senate Republican leader, all elected officers of the Republican State Central Committee, national committeemen/women, President of Republican County Central Committee Chairmen’s Association, and chair or President of each Republican volunteer organization officially recognized by the Republican State Central Committee (RSCC) shall be electors. U.S. Senators, Representatives in Congress and persons holding office of trust or profit of the U.S. may not be electors. Any additional vacancies shall be filled by appointment of the chair of Republican State Central Committee according to Republican State Central Committee bylaws. Republican State Central Committee Chair must file the list with the Secretary of State by October 1 of the presidential election year. Elections Code § 7300
In the American Independent, Green and Libertarian party electors are nominated at their state convention and the state chair certifies their names and residence addresses to the Secretary of State. Elections Code § 7578
In the Peace and Freedom Party electors are nominated at their state convention. Electors shall be 50% women and 50% shall be men. The party chair certifies the list to the Secretary of State. Elections Code § 7843
No incumbent Senators, congressional representatives or persons holding an office of trust or profit of the United States can serve as electors.
The House of Representatives makes the decision with each state having one vote. Representatives of at least two-thirds of the states must be present for the vote. If they cannot decide by March 4, then the Vice President becomes President and the person receiving the largest number of Vice President votes becomes Vice President.
This information and more is available at the National Archives and Record Administration, website: www.archives.gov/federal_register/electoral_college.