The founding fathers established the electoral college as a compromise between allowing the president to be elected by the people or elected by Congress.

They wanted to have an executive branch independent from the legislative branch to ensure the success of checks and balances, but they also had concerns about a direct democracy.

James Madison in particular feared that factions of the population would become a majority and threaten the interests of the nation. This was later deemed the “tyranny of the majority.”

The founders wanted to maintain the spirit of democracy in allowing every citizen to have a vote, but they also wanted to make sure the president would be selected by a group of “men most capable of analyzing the qualities adapted to the station,” as Alexander Hamilton wrote in “The Federalist Papers: No. 68.”

While there is some debate about whether the United States should keep the electoral college, it remains an important part of our elections today. Here’s a look at how it works:

How many electors are there?

There is a total of 538 electors, one for every member of Congress and three for the District of Columbia. Each state gets the same number of electors as representatives and senators.

A candidate needs 270 electoral votes to win the presidency.

Who are the electors?

Electors can’t be senators, representatives or any other person holding an “office of trust or profit under the United States,” according to the Constitution.

The political parties in each state choose potential electors before the general election. There are varying rules from state to state, but generally, the parties nominate electors at the state conventions, or a committee within the party holds a vote. The electors are often state politicians or party leaders.

The electors are officially decided on election day. By voting for one candidate, each person is essentially voting for the electors who will vote for that candidate. In some states, the names of the electors are listed on the ballots with each candidate.

What are the rules about which candidate an elector can vote for?

There is no constitutional law binding an elector to vote for the candidate who won the popular vote in his or her state, but the general assumption is that they will vote based on the popular vote. In 25 states and the District of Columbia, electors are bound by laws or pledges to the party to vote for the party’s candidate if they win the popular vote.

How are electors awarded to the candidates?

Almost all states have a winner-take-all system to award electors to candidates. This means that once a candidate wins over 50 percent of the popular vote in a state, they will earn the number of electors in that state. The two states that do not have a winner-takes-all system are Maine and Nebraska. They each have a proportional representative that awards electors to both candidates after the popular vote.

When does the electoral college vote?

Even though the winner of the general election will be known on Nov. 8, the electors won’t actually vote until weeks later. This year, they will meet on Dec. 19 to cast their ballots.

Following the election, the governor of each state is responsible for preparing seven original Certificates of Ascertainment, which identify the winning electors and include the number of votes for all electors. They must be signed by the governor and include the state’s seal. The officials must send one of the original certificates, as well as two copies, to the archivist of the United States at the Office of the Federal Register. States must hold the remaining six certificates.

The states then hold the meetings with their electors to allow them to cast their votes on Certificates of Vote. These certificates include all the names of the electors casting their vote. They are paired with the Certificates of Ascertainment, signed by all electors, sealed and sent to specified federal and state officials. One is sent to the vice president, two are sent to the archivist of the United States, two are sent to the secretary of state of each state and one is sent to the chief judge of the federal district court in the location where electors met in each state.

The officials must receive the certificates by Dec. 28, and Congress then counts the votes on Jan. 6, 2017.

Is it possible a candidate could win the popular vote, but not the electoral college vote?

Yes, this happened in the 2000 election. Al Gore actually won more of the popular vote than George W. Bush by about 540,000 votes. But Bush won 271 of the votes in the electoral college, while Gore won 266, because of the way electors are distributed and how many electors each state has. Since most states use a winner-take-all system, a candidate can win a significant number of electoral votes in a larger state even when the popular vote is close.