When company A announces that company B is buying them out, you will almost always see a premium on company A's stock compared to its recent trading price. For example, company A's stock may be trading at $50 on the day a deal is announced for company B to acquire the company at $60 a share. In most cases, that announcement will cause company A's stock to jump closer the premium price, in this case $60, on the next trading day.
However, the announcement of an acquisition or a merger does not necessarily mean that the deal will close as originally proposed. Speculation of the merger's final result will affect the state of company A's share price. For example, if rampant speculation and analysis by the market suggests that another company may make a bid against the original acquirer for company A, the market may bid up A's current stock price to exceed the original buyout price in anticipation of a bidding war.
If the market speculates that the target may not be purchased by anyone (for example, antitrust legislation may strike down mergers in the industry or a material financial change may occur to the acquirer or target, changing the attractiveness of the deal), the stock price may not move or may even fall after the initial buyout announcement.
The situation becomes even more complicated if the buyout is accomplished with a combination of cash and stock, or if company A is set to pay a dividend between the date the deal is announced and the date it's set to close.
However, if the market assumed that the acquisition will go through at the designated price, the current share price might be slightly off as a result of transaction costs. Traders may attempt some arbitrage by buying the stock, even at a small discount to the buyout price, if it means that they will be able to sell it to the acquirer to gain a small profit. This demand for the stock will slowly drive it up on the exchanges until the cost of the commission to buy the stock eats up the slight spread between the cost to buy the stock and the buyout price.
Once the deal closes, if it's being paid solely in cash, company A's shares will disappear from your trading account and the amount will appear in your cash account. If the deal involves both cash and stock, the cash and the new shares will be reflected in your account on the day following the close.