The way I understand it is that when a company that has stock decides to turn back into a privately owned company they have to buy all their stock that everyone owns first then they void it. If they don't need all of their stock and someone does not sell their stock does that stock become worthless?
There's a vote of shareholders, and once the sale is agreed to by the required majority, and regulators approve, it's done. It's not that the shares are worthless, they are non-existent, replaced by cash, or some combination of the takeover company and cash. Each deal has its own terms.