How does vote-counting work in the United States?

The United States is unique for its lack of a central federalised system to count votes. While rules vary from state to state, in general, voters decide whether to vote by mail, drop the ballot off, or come to a polling booth on election day. The same-day ballots are counted differently to early votes.