Major shareholders don't care who owns Twitter. They don't give permission. They only care about the return on their investments. They often represent limited partners or are part of a stock fund, and have their own fiduciary responsibilities. Or they just want to make their own money.
In this instance, major shareholders would go to the Board and say, "show me your plan to increase the stock price to over $54/share within 12 months." This could be by finding another buyer, having a roadmap to introduce new products/enter a new market, raise prices, or even acquire another company. Shareholders would evaluate the execution risk of said plan vs. the zero risk of "Elon gives me $54/share tomorrow" and decides what is best for them.
The shareholder then weighs in to the board: "I don't believe in your plan, if it comes to a vote I will vote in favor of Elon's offer." Repeat that for all of the major shareholders.
In this specific case, from everything I've read Twitter had no compelling roadmap, no other buyers willing to make an immediate offer, no strategy, troubled leadership, a 10% decline in stock price, and prevailing economic headwinds. No one believed they could beat Elon's offer.
So the board looks at the intent of the preponderance of the shareholders and rapidly realizes that they would lose any battle for control of the company. It would cause huge distraction and possibly open them up to lawsuits for not meeting their fiduciary responsibilities.
The board then goes back to Elon and decides to accept the offer.