Don't necessarily expect to have it on election night. Some states, including California, continue to count ballots postmarked on time that arrive after election day. Others can't even start counting mail-in ballots until election day.
Yes, they can -- and have, multiple times, because of the electoral college. The most recent popular vote loser in office: President Donald Trump.
The president could challenge state results. But he can't just refuse to step aside once the election is determined. Once a new president is sworn in, the previous one is out, whether they lock themselves in the building or not.