The Financial Times takes a sober look at the tricks Trump and the GOP could pull to keep him in power if he loses the election. FiveThirtyEight offers a similar analysis. With a vast patchwork of state legislatures, electors, vote-count shenangigans, congressional maneuvers and courtroom fights to wage, it could go on for months, and even see Nancy Pelosi installed as a caretaker president after Trump's current term ends.
The grim reality, though, is if it gets to that point, awful things will already be happening in the streets. From the FT:
Such uncertainty amid high expectations for victory on either side risks civil unrest that increases pressure for one side to concede, officials fear. It could also pit the military against civilians who have taken to the streets. "Leaders are already thinking through the potential for unrest," said a former senior military officer in touch with top Pentagon officials. Pentagon leadership has insisted the US military has no role to play in any election dispute and has openly discouraged Mr Trump from invoking the 1807 Insurrection Act, which would give him the authority to deploy troops to quell any civil unrest.
Biden has to either win enough electors to obviate the possibility of the candidates sharing a tipping-point state, or win by enough votes in such states to make a slim electoral college advantage unassailable.
The tl;dr of this and the other articles like it: if Biden doesn't go to bed in the early hours of November 4 a clear Florida-worth of called electoral votes ahead of Trump, Trump can probably engineer the war he wants. This even if it's obvious Biden will still prevail after mail-in votes are counted.