The difference between a merger and hostile takeover has to do with the manner in which the two companies combine to become a single legal entity and the opinions of the corporate directors involved.
In a merger, two or more companies (usually of similar size) combine to pursue business as a single company. This may be beneficial if both companies sell similar products and decide cooperation is better than competition, or if the businesses complement one another. In a merger, the surviving company acquires the shares and assets of the target company, with the approval of the latter's directors and shareholders. The target company ceases to exist as a legal entity. Shareholders in the disappearing company are given shares in the surviving company.
In a hostile takeover, the target company's directors do not agree with the acquiring company's directors. In such a case, the acquiring company can offer to pay the target company's shareholders for their shares in what is known as a tender offer. If enough shares are purchased, the acquiring company can then approve a merger or simply appoint its own directors and officers to run the target company as a subsidiary.
A hostile takeover can also be achieved by a proxy fight. The acquiring company obtains authorization from the target company's shareholders to represent their vote by proxy. With proxy authority, the acquiring company essentially becomes the majority shareholder of the target company, enabling it to approve the merger.