Elections are all edge cases. Votes are cast and tallied by a wide variety of Americans who all have the same goal but often different ideas about how to go about it. Votes are cast in cities and rural areas, in places with millions of constituents or dozens. Many elections are run locally by someone you should mentally picture as your well-meaning aunt. The sheer scale of such an operation is astounding. We live in a country that spans a continent and 9 time zones .
This great country contains lots of different people with lots of different ways of going about things.
On election day in America, polls open at a particular time and close at a particular time. Those times, like almost everything else, depend on where you’re talking about and can vary even within a single state and could change any year.
We have grown accustomed to live results of elections. This is definitely not something our grandfathers had and is mind-bogglingly complex once you start to think about it.
With American elections “live” does not mean getting the results of votes immediately after they are cast. The closest we can get for now is seeing vote results as they are counted after polls close. 
Any particular office (be it a Senate or a President or local Sheriff) has a variety of candidates from a variety of parties. Generally we think of races as between two front runners, but people often vote for third parties or write in candidate’s names and those votes need to be accounted for.
Here’s what we can agree on: A race is run by n number of candidates for a single office.
You might say “at least we can assume the candidates are human” - but you would be wrong . Never assume in elections.
Every eligible(!) person who lives in the area that candidate represents (districts for the house, states for senators, the entire country for presidents) gets to vote between the candidates running for each office that represents them. 
Constituents show up to their polling place. Or, well, sort of. 39 states have mechanisms for early voting, 28 allow no-excuse absentee votes, 19 allow voting with an “accepted excuse”. 36 million people voted early in the midterm election. - that’s about 30% of the 117 million total votes cast.
When reporting votes, absentee votes are typically only available at the county-level and not be precinct.
In order to vote, an eligible potential voter must register. Voter registration is handled by government officials on the county and state level.
Once registered on voter records, voters can be removed for any of the following reason:
Voters can be removed from records for a few reasons:
- Disenfranchising criminal conviction
- Mental incapacity
- Change in residence
- Never eligible: under 18 or noncitizen
- Voter self-requests removal
- First past the post is what most people think of. Voters mark a ballot with the candidate they want to win, and the candidate who receives the most votes wins.
- Runoff voting works similarly, but there is a minimum amount of votes required. If no candidate exceeds that minimum, some candidates are eliminated and a second round of the election is held (usually with the top 2 ranked candidates).
- A Louisiana primary is similar to an open primary where all candidates running for an office appear together on the same ballot, including multiples per party (instead of a party picking a single candidate to run in a race). The race goes to runoff if no candidate wins by simple majority.
- Maine is the first U.S. state to enact instant-runoff or “ranked choice” voting  Instead of voting for one candidate over another, voters rank the candidates in order of preference.
Presidential, senate, and gubernatorial races are organized by county and state.
House races are organized by house districts. The borders of these house districts are primarily decided by state legislatures but some (AZ, CA, ID, WA) are made by independent commissions. 538 did an excellent piece on congressional redistricting and gerrymandering.
Once a vote is cast, ballots are counted and the counts are delivered to a central location and the numbers are reported in regular intervals (usually). That is all handled by state and local governments, often by county and state boards of elections.
The media (and by extension, the public) are given access to the vote counts at this point. Often times you can find a website run by the Secretary of State which will have the latest results for different statewide elections. Data services will pay reporters or stringers to go to the places where votes are counted to and send the results back to competing data services which then resell that data to news organizations (live election results are not cheap).
County-level presidential results 2008-2016 have been collected in this GitHub repo
Geographic Identifiers: FIPS Codes
House districts are identified by their district code. New York’s first district is
NY-01. Large states with smaller populations like Montana have only one congressional district (“at large”), denoted like
I’ve seen various systems handle this different ways. Some designate these districts with
MT-00 so at least you can rely on two numeric digits when writing your code.
Counties are identified by county FIPS codes . The first two numbers of a county FIPS code are the state code, which is handy.
Mapping live election results
At NBC the Big Board is commanded by Steve Kornacki, who is the best in the business if you ask me. He stands by an enormous touch screen showing the latest vote results and explains what is happening and why it is interesting.
Typically he is pointing at a map of the country, or a particular state. That map has various counties or districts or shapes colored red and blue. 
The election data comes in as a big list of states, counties, and districts. A handy way to refer to all of these buckets of votes at once is as a reporting unit.
Each reporting unit contains different races.
In addition to the general elections that gather the most attention, parties hold their own elections to decide who will run against the other party, the primaries .
These primaries can take various forms including: uncontested (no challenger) or runoff/Louisiana /blanket . They can be open or closed, partially open, partially closed, etc… - remember, edge cases.
Voting machine security in the United States is currently a joke. The joke is not funny when you consider the real-world impact of such an important lever of our society left comically unguarded.
Coverage of elections
In 2018 I did some design research (captured in a twitter thread ) and went through some old footage of NBC election coverage. I was even able to incorporate the effect of numbers counting up as they changed into the 2018 version of the Big Board.
I had the fortune to join a politics-covering media organization in 2016, a year when suddenly there was intense interest in how media organizations covered politics. Many feel the media failed in the coverage of the 2016 election.
I think it is worthwhile to listen to those criticisms and think of ways that things might be improved.
Horse race election coverage
Jack Shafer wrote in Politico about why horse race election coverage might be good.
By giving voters a window on the closed world of insider politics, horse-race stories help focus reader attention on the races. Without the work of election handicappers, coverage would come to resemble an endless series of policy white papers that nobody reads. The presidential campaign has another 22 months to run, leaving plenty of time and space to explore the contest from multiple perspectives.
Election night 2000
At NBC the old heads would whisper to never fuck up as bad as they did back in 2000. A CNN internal report called their own election night coverage in 2000 “a disaster”.
Following the election night coverage – in which CNN, ABC, CBS, NBC, Fox and MSNBC all made wrong calls on the Florida vote – several networks ordered investigations of their coverage.
Based largely on exit polling, the networks first declared Mr. Gore the winner in Florida, only to give the state to Mr. Bush later. Ultimately the networks backed off again, declaring the race undecided.
The coverage of 2000’s presidential election lead to executives from CBS, CNN, Fox, NBC, and the AP being called to testify in front of congress by committee chair “Billy” Tauzin (R-La.).
Much of the testimony focused on the networks’ reliance on exit polls and the flaws in the VNS system of conducting the polls.
Tauzin introduced legislation to create a uniform poll closing time across the country and asked the networks to voluntarily resist projecting winners until 9 p.m. EST. In a concession, all the networks said they will refrain from calling a state until all the polls in the particular state have closed.
Why do we have elections on Tuesdays?
It could be argued that it would make more sense for elections to be held on the weekend.
Monday was out, because it would require people to travel to the polls by buggy on the Sunday Sabbath. Wednesday was also not an option, because it was market day, and farmers wouldn’t be able to make it to the polls. So it was decided that Tuesday would be the day that Americans would vote in elections, and in 1845, Congress passed a law.
- Ballotpedia is an exceptional source of all of the strange little constantly-changing details about elections,
freely editable like Wikipediaedited by Ballotpedia staff.
- election-geodata is a great collection of geographic precinct shape data for mapping election results.
- OpenElections is an open-source project made to create a “free, comprehensive, standardized, linked set of election data for the United States, including federal and statewide offices” which is a pretty incredible goal if you ask me.
- 270toWin has great maps and information on historical elections.
Article 1 of the Constitution “The House of Representatives shall be composed of Members chosen every second Year by the People of the several States…” - Section 4: “The Times, Places and Manner of holding Elections for Senators and Representatives, shall be prescribed in each State by the Legislature thereof; but the Congress may at any time by Law make or alter such Regulations, except as to the Places of chusing Senators.” ↩︎
This makes sense, when you think about it. There is reason to believe if you could turn on your TV and see how your candidate was doing, if you could see the vote counts live and your candidate was safely ahead, you might decide it’s not even worth going out and casting a vote. ↩︎
The election of Senators was not always given to the population in general. The framer’s constitution left that to the states. “The framers believed that in electing senators, state legislatures would cement their ties with the national government. They also expected that senators elected by state legislatures would be freed from pressures of public opinion and therefore better able to concentrate on legislative business and serve the needs of each state. In essence, senators would serve as “states’ ambassadors” to the federal government.” - it turned out to not work well because states never got around to electing them. ↩︎
During my time at NBC, the rules about when to color shapes has been debated. House districts are only colored for a particular party when that race has been called (not projected) by the NBC decision desk. This means there is basically no chance it will ever change color. Counties, on the other hand, never technically have a “winner” but a “leader” who has a majority of votes in a particular county. Counties were colored by whoever was leading the votes. Once the first votes came in, if there were 50 for the D and 51 for the R, the county would color for the R. ↩︎
There are 4 main types of voting machines: Optical Scan Paper Ballot (little bubbles you fill out by hand), Direct Recording Electronic (computers with touch screens or buttons), Ballot Marking (a computer marks paper), and Punch Card (voters punch holes and avoid whatever “hanging chads” are) ↩︎