This can be voluntary, when the company chooses to do so for strategic or financial reasons, or involuntary, when the exchange forces the company to delist.
Companies may want to delist for a number of other reasons:
Make short-term profits.
If a stock trades below its intrinsic value, the company may repurchase its own shares to profit over the short-term before delisting.
This can also produce rewards for current shareholders, giving them considerable returns
While you can still sell your shares when a company trades over the counter, the bid/ask spreads may be relatively wide, meaning that buyers willing to pay your desired price are scarce.
Although some brokerages restrict such OTC transactions, you generally can sell a delisted stock just as you would a stock that trades on an exchange.
A delisted stock can continue to trade over the counter for years