The world of media relies on a constant exchange of value between different parties.
Brand owners pay ad/media agencies to create advertising designed to generate extra sales for their clients. These agencies then pay media owners to expose the advertising to an agreed audience amidst their content. The advertising is then exposed to consumers. The number of relevant consumers reached depends on the audience achieved by the content. This exposure results in additional sales for the product. Whether or not the advertising was worth the investment depends on the profit associated with the incremental sales generated vs the cost of the advertising.
See this blog post from Lumen for more on this topic.