I once had to explain to a "wingnut" co-worker that the election reporting on television the night of the election were not the official results.
In each jurisdiction, there is a "canvass" some time after the polls close.
https://www.eac.gov/sites/default/files/electionofficials/QuickStartGuides/Canvass_and_Certification_EAC_Quick_Start_Guide_508.pdfThe deadlines vary from State to State
https://www.ncsl.org/elections-and-campaigns/canvass-deadlinesAgain, our former President moaned that the reports on TV shifted from candidate to candidate as the informal results were reported from jurisdictions of different populations, obviously a plot against him.
My memory shows several elections during my lifetime when the informal result was not known before midnight on Election Day.
The results in the extremely tight contest between Bush and Gore in November 7, 2000 were not final until a Supreme Court decision on December 12.
Post-mortem analyses by different academic groups showed different results in Florida, where the results determined the final electoral count.
If Gore had won his home state of Tennessee, the Florida vote, with a reported margin of 327 votes would not have mattered.
The final result, including Florida's 25 electoral votes, gave Bush a 1 vote margin in the Electoral College.
Gore did not fight the case after the Court decision, but he did win the popular vote.
In 2000 and 2016, the popularr vote winner lost the Electoral College.
The court case actually was to stop a proposed recount of the Florida vote, and is widely considered to have been political in nature.