Each state gets a number of electors equal to its number of Congresspeople + Senators. Between the 50 states and District of Columbia there are 538 electors. The candidate who gets a majority of the electors wins. A majority of 538 would be half + 1, or 270.
This Wiki article on the Electoral College does a good job of explaining it. 48 states plus D.C. have a winner-take-all rule. One candidate can win 51% of the popular vote, and they'll get 100% of that state's electoral votes. 2 states, Maine and Nebraska, are a little different -- I think their method splits the electoral votes to better match the popular vote.