1. You buy 51% of the shares (and voting rights), make an offer to buy the remaining 49% and call for a shareholder meeting to vote on the offer. You have the majority, vote yes, and acquire the company.
2. You acquire 90% of the shares. You don't even have to call for a shareholders vote; you can acquire the company immediately and squeeze out existing shareholders who are forced to sell and the offer price.
You can either acquire shares by submitting a tender offer (offering to buy shares at a specified price from shareholders) or tapping the public markets (and disclose it). If you think about this a bit more, you'll see there are ways to game the system by, for example, buying enough rights then making a low-ball offer but most of the loopholes are well covered by corporate law.
To address your complaint on fairness, yes, you can be forced to sell because if most of the shareholders want to take the company private, it would seem fair from the majority's standpoint to accept its rule. Not perfect but I don't think there exists a better mechanism.