The electoral college is a difficult thing to wrap one's head around. Although Americans like to think that they directly, democratically elect their presidents, the job is actually done, as ABC News explains, by electors: people whom each state's Democratic and Republican parties select, who support their respective candidates and are not on the federal government's payroll.
Electors' votes technically decide the outcome of each election, but our votes do matter: Generally, the party whose candidate wins the popular vote within a state wins all of that state's electors, who then cast their votes for the party's candidate. Whoever gets the most electoral votes gets the Oval Office, having been elected — indirectly, but still democratically — by his or her constituents.
538 electoral votes are cast at every election, so a candidate needs 270 to secure a majority. The number of electoral votes each state gets is ultimately based on population: "Each state is allocated a number of electors equal to the number of its U.S. senators plus the number of its U.S. representatives," according to ABC News. So the more densely populated states — like California, for example — are especially valuable, along with the so-called swing states.