I'm surprised this passed (in the house at least) at this point in the election cycle. My suspicion is that ByteDance will in fact refuse to divest, and TikTok will get banned. Which I don't think the electorate will like very much
ByteDance will sue, and the court case will likely go to the Supreme Court. If they left the USA without any legal contest, then they would be walking away from a huge amount of money.
AIPAC is willing to sacrifice Biden's re-election chances for this short-term victory because the other candidate and his whole party is also going to be favourable for them, possibly even more so.