"Do all the fancy stuff to select which image at the server end"
It doesn't even need to be fancy. You know what page the user's browsing. You know what's on the page because it's your page. So you know what he's interested in. After that it becomes easy to add the relevant ad to the page. So easy, in fact, that the advertiser and publisher need very little in the way of middlemen to take a profit from. Now why do you think the advertising industry doesn't try to sell that solution instead?