The profit maximizing rule stats that profit = total revenue - total costs, meaning that profit maximization occurs where the largest gap between total revenue and total cost is found. The rule is by no means concrete when applied to the real world, but does offer a fairly accurate prediction of how a business can fully realize profit potentials.
Profit maximization applies in a variety of theoretical environments, although some may alter exactly where the maximization point is found.
In a monopoly environment for example, less goods need to produced, although products can then be sold for a higher margin than in a normal competitive environment
With theoretical perfect competition, the equation remains the same, with profit maximization occurring at the largest gap between total cost and total revenue.
Real world applications are never likely to be completely accurate, but are still useful. In the real world, competitive firms often alter prices, which has knock-on effects. While the equation is a useful device for gaining insights, many firms often choose to use this as a starting point for trial-and-error experimentation in order to locate the best margins and therefore highest profits. This is an ongoing and ever changing dynamic however, which requires constant attention.