What you are describing is called a corner. Disclosure laws have made them, at best, rare. I don't think there have been any successful corner attempts in the capital markets since the laws were put in place. It is still, at least in theory, possible to corner commodities markets. The commodities markets don't just permit insider trading, the law assumes that it must happen. When you combine that with a lack of disclosure laws, it is not impossible for it to happen.
As a practical matter, it would have to happen from a sequence of mistakes. For example, to actually buy every share would require a tender offer. The law requires specific disclosures to do what you are asking about.
The person that was short would have to be in a coma, for example, to not exit such a position. If the tender offer was successful and the goal was to buy all shares, then short-sellers would be scrambling to exit their positions. In such a case, it is likely the broker-dealer would close the position if the client didn't since there would be no available shares to short once the firm is no longer public. If the seller does not act, the broker will.
I will describe how it could happen, but how it would be resolved is unclear.
The person with the short position would have to be clueless or incapacitated after the start of the short position. There has to be something to prevent the person from closing the trade.
The broker-dealer would have to have a major software error. A hardware error would not persist long enough. Something would have to happen to segregate the one affected account in such a way that nobody knew it existed.
The regulatory oversight elements of the broker-dealer would have to break down as well.
All of that would have to persist until the tender offer was complete.
The open question is what happens to the party that loaned the shares. For example, assume that I own the 100 shares of ABC corporation and my broker shorted it. If I wanted to tender the shares, then I would be paid in cash out of the broker's pocket at the tender price. The holder of the short would come up with the cash.
On the other hand, assume that I own the 100 shares of ABC corporation and I want to be a minority shareholder. That is where the problem would come in.
My guess is that some form of binding arbitration would take over built around my estimation of the value of the firm. As long as my price is within reason, I would probably get it and the short seller would pay it. However, I don't know.
It is important to remember that if you and I form a group and we plan to buy the company up in pieces, then under the law we are considered a single buyer and all of the disclosure laws with their criminal and civil penalties kick in. It is against the law for a group of people to try to do this unless they disclose to the world what they are planning and how they are planning to do it. If they did, it would defeat the purpose of the group.
A short position is a loan paid in stock. Contract law provides a remedy for a contract that cannot be fulfilled.
There are other ways it might happen, but they all require negligence and systematic mistakes. The remedies would vary depending on the specific course of events.
Again, disclosure laws make what you are describing difficult because a person in a position of control, such as a 5% shareholder, cannot make swing profits. Any swing profits must be forfeited to the US Treasury. So, for example, imagine that I buy 10% of ABC company today, causing a short squeeze. I cannot sell any shares for six months unless I want to forfeit my money to the Treasury. It is against the law for me to profit from causing a short squeeze. Nor could I tell anybody of my plans because if I did, then it would be insider trading for them because I am a control person.
So, if you want to plan a squeeze, it is against the law for you to profit from it unless the squeeze lasts for six months or more, which it won't. Other people, that do not know you, can profit from the squeeze, but you cannot.
That limits the desire to corner a capital market.