Worse comes to worst, Tesla is bought out by whatever car company that has the biggest gap in autonomous and electric tech.
A lot of the value in buying a company like Tesla is the patent portfolio. In 2014 Musk announced that these would be "open source", but I can't actually seem to find any legalese with the details.
As for the rest, I imagine the residual value is brand, a lot of which is deeply entangled with Musk himself. As a buyer I'd be asking for a hefty discount because I would expect Musk wouldn't stick around to spruik the goods.