Whoever ultimately wins, the Presidential election being this close means Trump severely under performed, since the structural factors were all in his favor.
First, he’s an incumbent, which carries massive advantages. Since 1900 the only presidents with a “normal” cycle of winning an election then running for re-election who lost their second term bids were Herbert Hoover (3rd Republican in a row, presided over the great depression), Jimmy Carter, and Bush 41.
Second, it’s still the economy, stupid. Trump came in with a growing economy which grew by ever increasing rates during his term up until the virus hit — something he can’t really be blamed for. And even with the virus, in September 56% of Americans told Gallup that they were better off then than 4 years prior. Reagan, Clinton, Bush 43, and Obama all won reelection with positive answers from 44%, 50%, 47%, and 45%, respectively. All things being normal, 56% of Americans self-identifying as better off than 4 years ago should mean an easy road for an incumbent.
Third, riots. America is still a largely middle class, working nation, where images of random businesses being burned and looted produce a visceral reaction of “that could have been my livelihood/life’s work/dream.” Riots in the 60s and 70s helped elect Nixon and Reagan, and the images today out of Portland and other locations could only help Trump. While Biden did condemn rioting and violence, he’s hampered by the fact that his party is associated with them, and he was unable to make his opposition to them a feature of his campaign less he lose parts of his base. Actually peaceful protests do not have this same effect, but the moment Molotov cocktails start flying on national TV, having any members of your party say “this is fine” tilts the national scale against you.
Fourth, Socialism. The Democrats looming largest in the public eye for the last several years are avowed socialists, including Biden’s primary opponent. Calling it “democratic socialism” does not convince most Americans, who are opposed to socialism by any name. Again, while Biden is explicitly not a socialist, he’s representing a party that publicly welcomes them. This puts a thumb on the scales in his opponent’s favor. The effect is particularly clear in Florida, where Cubans, Venezuelans, and other groups with recent experience in socialist/communist countries voted Republican in greater numbers than usual, despite Trump’s history of racially questionable remarks.
In short, given the structural factors in Trumps favor, he should have easily ran away with the election. That Republicans seem likely to over-perform in the Senate, where the party faced an unfavorable electoral map, speaks to this. Trump’s failure to do the same can only be because his words and deeds went a long way to cancelling out the structural factors in his favor.