Economies of scale exist when a firm expands its production and sees its long-run average costs decrease. In a situation like this, being bigger helps a firm. If a firm grows larger, its costs drop, making it more profitable than smaller firms.
One reason for economies of scale is specialization of labor and of machinery. When companies are small, it is hard for them to specialize. Individual workers might have to do many different jobs. This would prevent them from simply doing one job and becoming extremely adept at that job. When firms are small, they are less likely to be able to afford specialized machinery. A small farmer, for example, might not be able to afford large, specialized machines for applying chemicals to their fields. If a firm cannot afford specialized machines, they have to make do with more generic machines that will not be as efficient at a given job. Because larger firms can specialize more, they can potentially enjoy economies of scale.
The other major reason for economies of scale is reduced resource prices per unit of output. Larger firms can often buy resources more cheaply. As one example of this, firms that buy large amounts of a commodity usually get discounts from the supplier. Suppliers are happy to give discounts because they get to be sure that they will sell large quantities to that firm. As another example, large firms can sometimes pay less for resources because they use their resources more efficiently. Imagine a movie theater that only has one screen. That theater will still need people to take tickets, to sell concessions, and to do other things. If the theater had five screens, it would probably not need five times as many ticket takers and concessions workers. Thus, larger firms can pay lower prices for resources, thus creating economies of scale.
Economies of scale and diminishing marginal returns can and do apply to the same firm. Economies of scale are not limitless. Every firm is likely to reach a point where it cannot continue to grow without hurting its efficiency. A firm that grows too large, for example, might start to waste money on excessive levels of bureaucracy. It might become less adaptable because it is too big. For any firm, it is likely that diminishing marginal returns will set in when the firm gets out of the range of production levels in which economies of scale can be realized.