There are a few reasons for which monopolies are, in certain cases, both desirable and beneficial. The first case to consider is that of a natural monopoly, which benefits from Economies of Scale (show the long run average cost on a diagram). In this case, it is positive for the society, because if the quantity demanded by the market was produced by more firms, consumers would have to pay a higher price, which is a problem especially in the case of commodities such as electricity.
When it comes to industries that need to invest in R&D, monopolies are protected with patents (example of a pharmaceutical firm and diagram). That happens because consumers need these new products, such as in the case of the pharmaceuticals, or these products would improve the society (tech firms). Namely, some industries need dynamic efficiency, which cannot be found in more competitive market structures.