If I remember right, profit results from the intersection of the Marginal Revenue Curve and the Marginal Cost Curve being higher than the Average Cost Curve, AND being higher than the demand curve. This only results when the market is not perfectly competitive (i.e. there are barriers to entry, non-identical products, few firms, etc).