In perfect competition firms are assumed to be profit maximisers. Firms will therefore produce where marginal cost is equal to marginal revenue (MC=MR). The price the firm charges is determined by the market because the individual firm is too small to influence price and is therefore a price-taker. Perfectly competitive firms can make super-normal profits in the short-run as shown in the diagram below. In this diagram the horizontal average revenue curve is shown to be above the average total cost at the point where MC=MR (point A). At Q1 the firm charges P1, but faces only average costs of P2, therefore it makes super-normal profit as indicated by the shaded area (P1, P2, A, B).
In the next diagram, the firm is making a loss at its equilibrium, profit maximising or loss minimising output, where MC=MR. The price charged per unit of output P2 is lower than average total cost, P1 and hence the firm makes a loss of P1P2CD.
If a firm were making super normal profits in the short-run, other firms would enter the industry eager to share these high profits. They would be able to do this as there are no barriers to entry in perfect competition. The entry of new firms stimulates an increase in supply from S1 to S2 establishing a price just low enough for firms to make normal profits.
If a firm were making losses, in the long-run, some firms would leave the industry as there are no barriers to exit. As a result of these departures total supply would fall from S1 to S2. Firms would continue to leave the industry until the whole industry returns to profitability. This can be seen in the next diagram. When the supply curve is at S1 the firm is making a loss. At S2 the supply curve is high enough to make normal profits.
In the long-run, competition ensures that the equilibrium occurs where the firm neither makes super-normal profits nor losses. This means average cost equals average revenue in the equilibrium.