Technically, we won't know until the State as counted the votes, certified the election, nominated its Electors, the Electors have cast their vote, the State has sent the votes off to the Archivist, the Archivist has delivered the votes to Congress, and Congress has counted the votes.
That will happen on January, 6th 2025.
However, it is very likely we won't need to wait that long. There are many different degrees of certainty with which the results in a State can be called long before January, 6th 2025.
Absolute certainty
All ballots have been counted.
If all ballots have been counted and one candidate has more votes than the other, it is generally safe to assume that this candidate has "won" the State. There are, of course, always exceptions, e.g., the candidate could die the next morning, Faithless Electors could vote for someone other than the winning candidate, etc. But typically, these concerns are ignored.
Mathematical certainty
One candidate leads by more votes than there are ballots left to count.
If candidate A leads by 100 votes and there are only 50 ballots left to count, then there is no way that candidate A can lose the election anymore. Even if all the uncounted ballots are votes for candidate B, candidate A will still win by 50 votes.
Statistical likelihood (short-term)
It is statistically unlikely that the uncounted ballots will change the outcome.
Even if there are more outstanding ballots than the difference in votes between the two candidates, generally, an assumption can be made about the distribution of votes in the uncounted ballots.
As a first approximation, it can be assumed that the distribution of votes in the uncounted ballots is roughly similar to the distribution of votes in the already counted ballots. If the margins are big enough, that is good enough. However, if the margins are smaller, that is not a safe assumption to make:
- Smaller counties will sometimes close their polls early and thus start their count early. However, the smaller counties tend to be the rural ones, which tend to lean Republican, whereas the bigger counties tend to be the urban ones, which tend to lean Democrat. So, it is likely that a lot of the votes that are counted early will be Republican whereas the uncounted ones will be Democrat.
- Smaller counties will be able to count their ballots faster than larger counties. Same as above.
- Absentee ballots are more complex to process because the eligibility of the voter is harder to verify than if they were voting in person. Therefore, absentee ballots tend to get counted later than in-person ballots. (In same States, absentee ballots can even only be counted after the polls are closed.) In the last few elections, the Republican candidate has urged their supporters to vote in-person, whereas the Democratic candidate has urged their supporters to vote as early as possible, including by mail. Therefore, it is likely that the absentee ballots will heavily lean Democrat – ballots by active service members (who lean Republican) stationed overseas notwithstanding.
It is perfectly possible to integrate all these points (and more) into a statistical model and compute the confidence level of a prediction. In that case, it is then merely a question of which confidence level a news outlet deems acceptable – some may be willing to accept higher risks than others.
Statistical likelihood (long-term)
However, none of the above actually explains the examples in the OP, where only 1% of ballots were counted, or in the second example, even no ballots at all. What is going on here is a different kind of statistical prediction.
Similar to the above, we can apply statistics not just to the current election, but to trends as well.
The second example in the OP is Wyoming, which was called with no ballots counted. However, Wyoming already voted 70% for Donald Trump in 2020. And in 68% in 2016. And 68% for Mitt Romney in 2012. 65% for McCain in 2008. 68% for Bush in 2000 and 2004. Even Bob Dole pulled in almost 50% in 1996, and that was with a strong third-party candidate. Old Man Bush won with 40% in 1992 (again with a strong third-party candidate) and 60% in 1988. Reagan won with 62% and 70% in 1980 and 1984. And the list goes on and on. Even John F. Kennedy lost to Richard Nixon in 1960.
The last time a Democrat won Wyoming was 1964, the last time before that was Truman in 1948. Given that Wyoming has been staunchly Republican for 60 years, and specifically Donald Trump had already won a landslide victory in the last two elections, there is simply no reason to assume that 2024 would be any different. Donald Trump had more than three times the number of votes as Joe Biden in 2020; even if, by some miracle, Kamala Harris managed to sway two thirds of Donald Trump's voter base to her side, she would still lose.
So, based on this data, it is pretty much 100% safe to call Wyoming for Donald Trump without a single ballot being counted. In fact, Wyoming is so safe for Donald Trump that well over half the people who voted for Trump in 2020 didn't even bother to show up to vote … and he still won by over 40%.
Votes aren't everything
There's more information than just votes.
Last but not least, votes aren't the only datapoint there is. Exit polls at the polling stations as well as polls conducted before the election can be used as well.