Ad networks take inventory from the publishers, package it up, and then sell it to advertisers.