Every company in the game is divided into ten shares, each worth ten percent, and you can buy into anyone, including yourself, as long as stock remains available. Price tracks the railroad's net worth, and it climbs further as shares become scarce.
Watch the newspapers. The game periodically announces stock market crashes and booms, and each one is followed by a stretch where every share either collapses or soars. A player with cash reserves and good timing can make a fortune, or a takeover, in those windows.
Once all ten shares of a railroad are held, any player may buy the entire company, but they must pay double market value for every share they don't already own. Hold seventy percent and you buy the remaining thirty at double price; hold nothing and you buy all hundred at double price. A company can even buy back its own stock, though the money goes to whoever sold, so it rarely makes sense.
At one hundred percent ownership you choose: merge, which converts the purchased railroad into yours and keeps its track, trains and routes, or liquidate, which pays you a share of its value in cash and removes it from the map.
The game effectively ends when every rival has been absorbed, or when someone buys you. If you manage to own everything, you can keep playing until the clock runs out or you retire.