Millions of votes were cast Tuesday in the approximately 300,000 local precincts across the United States, making an organized effort to tamper with the outcome virtually impossible.

There is no national election code. Rules are set up by states and counties, based on local history, population size, topography, budgetary restrictions and culture.

Voting options vary from county to county and sometimes within counties. There are handles to pull on voting machines, punch card systems (remember the hanging chads in Florida in 2000?) and touch screens under the watchful eyes of election judges. Some voters also submit their selections on paper ballots.

An individual’s vote is secret, sealed in ballot boxes that either are counted at the precinct or transported to a central vote counting facility, usually a government office at city hall or a county courthouse where certified observers from the political parties or representatives of the candidates monitor the process to ensure it is fair.

Where paper ballots are used, election officials read each ballot and tally the vote for each race. Punch cards are run through special readers and computerized ballots are transmitted electronically or on disks or cassettes that are transported to the counting center.

Though some votes are lost due to voter error, equipment malfunction or mistakes by election officials, there has been little evidence of vote fraud. A Loyola University study released last month indicated of more than 1 billion votes cast from 2000 to 2014, there were 31 cases of vote fraud.

A candidate can demand a recount in a precinct if the results are extremely close. Some state laws call for mandatory recounts depending on the margin.

Once the popular vote is determined, the Electoral College comes into play. All states except Nebraska and Maine award their electoral votes on a winner-take-all basis. The number of votes a state has is determined by the size of its congressional delegation — one vote for each House district plus one for each of a state’s two senators. Nebraska and Maine apportion their electoral votes by congressional district with the winner of the popular vote getting the two Senate votes.

Members of the Electoral College meet in their state capitals Dec. 19. Assuming one of the candidates wins 270 electoral votes, the results will be certified by the new Congress Jan. 3.