Each state has a number of electors equal to its number of seats in Congress. The minimum is three. California, the most populous state, has 55.
Forty-eight states and the District of Columbia, which also gets three electors, follow a winner-take-all system. The presidential candidate who wins the popular vote in that state gets his or her slate of electors selected. (Maine and Nebraska use a different method.)
There are 538 votes in the electoral college. To win, a candidate needs at least 270 votes. If no one gets that many, the newly elected House of Representatives decides the winner.
So how is it that a candidate can win the national popular vote but not win the election?
Let’s use 2016 as an example. Nationwide, Clinton got nearly 2.9 million more votes than Trump. But her votes were clustered in a few, more populous states, so the “excess” didn’t help her electoral vote total. Trump, by contrast, won several less populous states and rode the winner-takes-all system to victory.
For more history on the electoral college, read this KidsPost story.