The same drama plays out every time the polls close on Election Day: Politics obsessives watch a needle toggle back and forth on a computer screen, refresh a webpage, and check Twitter, waiting for the number of precincts reporting results to tick up from zero percent.

It takes time, sometimes hours, for those numbers to trickle in on election night. But that sometimes excruciating wait is American democracy at work — literally.

What we don’t see is what’s happening behind the scenes.

In Los Angeles County, for example, when the polls close at 8 pm, helicopters escorted by the sheriff’s office deliver ballots to the county clerk’s headquarters in Norwalk, touching down in an open library parking lot. The sheriffs carry the ballots inside and deliver them safely and securely to the county clerk for processing and tabulation.

In other states, votes are called in by telephone or driven to a central counting location in designated poll workers’ cars. The decentralized US electoral system means that procedures and policies vary from jurisdiction to jurisdiction, meaning states count and certify votes at different paces.

But here’s an overview of how it usually goes.

1) On Election Day: wait for the polls to close

The votes cast on Election Day aren’t tabulated until the polls close. That doesn’t always happen on time either, as people are allowed to cast a ballot as long as they’re in line at the polling station by closing time.

2) After the polls close: make sure there aren’t extra ballots (or missing ballots)

Once the vote is officially closed, poll workers will shut down the voting machines and download or pull the memory card or stick that stores the votes. Workers might also run or print out a summary of the voting machine, a kind of receipt for the number of ballots cast, said Barry Burden, a political science professor and the director of the Elections Research Center at the University of Wisconsin Madison.

Then poll workers need to ensure the total number of ballots cast at a polling site matches the number of people who signed in to vote at that site. If there’s a discrepancy, workers have to undertake a process called “reconciliation” to figure out where the error arose to make sure the number of ballots equals the number of voters.

“It’s a little like a worker at a retail establishment at the end of the day closing down the cash register and trying to make sure the drawer adds up to the amount that was charged during the day,” Burden said. Poll workers, however, have a higher standard — to get it exactly right. “They don’t want there to be any mystery about missing ballots,” he added.

The reconciliation can go quickly, or it can go slowly if the numbers don’t align or if the process is happening in a large jurisdiction with many voters.

3) Deliver the votes (by phone, by modem, or by hand)

The votes then have to be transferred to a central location. This can be a county board of election, the county clerk’s office, or a state election official’s office, just to name a few — different jurisdictions have different rules.

Sometimes the chief poll worker might read the results over the phone to someone at election headquarters, who will input that data on a spreadsheet. Some voting machines are equipped with modems that connect to a telephone line (not the internet) and can be transmitted electronically.

Other methods take longer. Memory cards or sticks may need to be physically delivered to voting headquarters. In these cases, the memory card enters a “chain of custody” and is delivered — frequently by car or, as in LA County, by air — to the county seat. There, it’s turned over to election officials, who will put the data storage device in their machines and download the actual results, Lonna Atkeson, a professor of political science at the University of New Mexico, told me.

Polling places are located where the people are — schools, fire stations, churches, and even some weirder spots, such as people’s homes. But those locations, particularly in rural areas, might be far from the county seat or official headquarters, which can slow down and complicate the vote tabulation process.

The system can seem somewhat precarious and insecure, but Burden said this is just for the initial tally — the actual paper ballots and records will be delivered securely to the county seat or state election officials after election night.

“It might seem like a crazy system that a couple poll workers are driving across the county at 10 pm with a flash drive in the glove compartment,” Burden said. “But you have to remember, in most states, there’s a paper record sitting back at the polling place, probably a box of ballots or a machine of some kind.”

Once the votes are tallied and delivered, in some cases, they’ll start to show up on the official state’s website. In other states, the elections commission doesn’t report anything on election night. In those cases, journalists are typically the first source for results. The Associated Press, for example, has journalists post up at county elections boards or call county officials for numbers, which they report back to the AP’s elections center.

Then a clerk enters the number, double-checking and verifying data, according to the AP. The AP is also equipped with critical demographic data and absentee ballot information that might help them fill in the gaps. When the AP or other news organizations officially call a race, they’re relying on a combination of vote counts and that raw intelligence to make the judgment.

4) Count provisional ballots and other ballots still trickling in

Some states consider absentee or overseas ballots valid as long as they’re postmarked by the corresponding Election Day, which means those votes are likely to trickle after the polls close. The same goes for expanded mail-in voting, whose deadlines vary, but states like California also require a postmark no later than Election Day, though they must be received no later than three days after the election. This can hold up the election results, and the winner might not be known for days or even weeks as ballots are returned to places with more forgiving policies.

There are also provisional ballots, mandated as part of the Help America Vote Act, passed in response to the 2000 presidential election and the Florida recount. Provisional ballots are essentially “just in case” votes; ballots are distributed if someone shows up to vote and his or her name doesn’t appear on the rolls, or the incorrect information is listed, or for some reason it looks like that person already voted.

Provisional ballots are usually tallied last, sometimes after the election night count, because they require greater scrutiny. A board has to review each of the provisional ballots and verify whether each individual is a legitimate voter. Provisional ballots can often delay the vote count because that process takes time. In California, in addition to the surge in mail-in ballots, the slog of counting provisional ballots is partly why Hillary Clinton’s share of the popular vote kept ticking up long after Election Day.

Even though the provisional ballots can slow counts, Edward Foley, a professor of election law at Ohio State University, said on balance it’s a good thing because it ultimately allows more people to participate in the electoral system.

“There is definitely tension and competing considerations between the desire for speed and the advantage of speed on the one hand, versus other factors which do inevitably slow things down,” Foley said. “And there’s no perfect solution to that push-pull or that tension.”

5) Canvass and certification of results (which can take weeks)

Even after the media calls a race or the counties total up the winner, the election results aren’t official. That usually takes a few weeks through a process known as the canvass, in which each vote is counted and verified, then officially certified, first by the local counties and then by the secretary of state or state Board of Elections.

Final vote tallies can shift between the election night count and the certified results — though usually not drastically. Sometimes that’s due to provisional or military or absentee ballots being added to the count.

There can also be disputes. Candidate can demand recounts, and some states trigger them automatically, depending on the margin of victory. Those recounts can change vote totals because they’re done with much more deliberation than on election night. But absent a high-stakes recount, most Americans have moved on after the victory speeches.

There’s sometimes a tension between election integrity and speed

Long lines at poll places, the reconciliation process, traffic en route to election headquarters — all those can slow down the initial vote counting process.

Other hiccups emerge along the way. Voting machines do break down, forcing some jurisdictions to count ballots by hand. Sometimes ballots can’t be run through the machines because of bizarre human errors. Those may have to be hand-counted — or recopied onto fresh ballots by election workers and then run through the machines.

“People do crazy things with their ballots when they have them at home, and so you have to sort of deal with those,” Atkeson said. She once observed a ballot on which someone had cut out the candidates he or she didn’t want to vote for.

Experts said it’s hard to gauge whether the United States is faster or slower than other democracies as a whole, mostly because the decentralized voting system means the US doesn’t have one uniform election system or even 50. “If you think about elections at the local level, we have 8,000 different electoral systems because of the localities,“ Foley said.

US elections also tend to be a bit more complicated than many other countries. Burden suggested in an email that in most other democratic systems, the voter is only choosing one or two offices — maybe a party or member of parliament. “In contrast, many US ballots are long and complicated,” he said. “They might involve ballots issues, school bonds, or referenda. And voters might write in names of unlisted candidates. All of these complexities may add to the time it takes process ballots.”

Still, speed is important. Local election officials do want at least the preliminary results out there. For starters, they’re usually elected officials themselves, so getting out timely information is probably helpful in keeping their own jobs.

A fast count also assures the public that the system is working. Foley said that starting with the Progressive Era at the turn of the 20th century, speed was seen as a deterrent to fraud — the faster the votes were counted, the less time there was for shenanigans.

That still holds true, but it’s balanced against other considerations, namely the security and fairness of our voting system. Concerns about the security of election infrastructure demand officials follow certain protocols: reconciliation, preserving paper ballots, and physically delivering election results to a central location. More flexible absentee deadlines and provisional votes also make sure the system allows as many eligible people to vote as possible.

“The process has gotten a lot slower as a practical matter because of the changes that we made since 2000 to improve the integrity of our system and the fairness of our system,” Foley said.

That can all seem a bit disjointed in our modern era. “We expect a kind of finality,” Burden said. “We also know when the Super Bowl is going to take place, and we know exactly what time and what network. And there’s a lot of buildup to that as well, and there’s a result at the end that’s satisfying because it has a finality to it.”

“And elections seem like they should be that way,” he added. “It’s just adding up the votes for different candidates, after all; can’t we determine very quickly who got the votes?”