you either get paid a cash value per share, a share value of the buying company per share or shares of the bought company, or a combination of the two.
Example Company A buys company B.
Company A pays $$$ per share of Company B (cash buyout)
Company A pays company B $$$ plus 1 share of company A per X # shares of company B (a combination)
Company A pays company B 1 share per X # shares of company B (a share swap)
It often depends on how big company A is and how they wish to go about things.
For heavily Diluted stocks common amongst Pennies it is rarely a share swap on a share per share Basis. The Parent company can't absorb more shares than they themselves have without a vote increasing their share count so if Company A has 100 mill shares and company B has a billion shares it will be either an all cash buy out per share, or company B will have multiple shares equal 1 share of the new company. similar to a reverse split accept your getting an established stock which is naturally a much higher value than the Penny you had.