Agencies that decide where an advertiser's money is spent (which channels, media owners, audiences and times), negotiate the prices, buy the media, and report on what it delivered.
Media agencies are one player in the advertising industry, and an industry of their own, with their own suppliers, customers, software, regulators, and money flows. This full map is on the roadmap.
Meanwhile: how media agencies fit into advertising