for SpaceX it's a bet that if Trump wins they will get far more lobbying power for contracts and Boeing/Lockheed will be even more screwed.
And while consumer opinion on Tesla and Starlink will be hurt, Elon is probably hoping to get Trump to tariff Chinese electric car competitors massively so his only competition will be domestic