Supposing that everyone in a market for a good has access to the same technology used for production of the good and can access the same market where inputs for the production can be bought to ensure a homogenous good and a perfect competition. In such a scenario all firms have in the market and all firms that can potentially enter the market have a uniform cost curve. In the short run the number of firms in the market is fixed. The entry of such a market depends on the incentives that influence existing businesses and potential new entrants. If firms that are already present in the market have high profits it is an incentives for other firms to join the market by setting up production or changing their product of focus. This free entry in times of good profits expands the number of firms, increases the supply of the good and pulls down prices and with it the profits. In the same manner, if firms in the market are experiencing losses and low profits many firms will exit the market which will bring up prices and increase profits. Remaining firms after the entries and exits must be making a zero economic profit. This process of entries and exits eventually drives average total cost and price to become equivalent at which point the process ends and firms are producing at their efficient scale.
Firms that already possess market power try to preserve it in two ways: either by trying to prevent other firms a homogenous good as they are or by stopping new entrants from joining the industry. There are some potential barriers to entry that can arise from such a situation.
N. Gregory Mankiw, Principles of Economics. Fort Worth: Harcourt, 2001.