If externalities are present, there is no general solution to the problem of optimizing either individual net utility or social net utility. Markets don't do it perfectly, but no other solution does any better, and in fact the most common alternative, government regulation, does worse on average.
How do markets optimize net social utility ? let's be more concrete , let's talk about a market with modern advertising ?
> How do markets optimize net social utility ?
In the absence of externalities, this should be obvious. And in the presence of externalities, I did not claim that markets optimize either net social utility or net individual utility. I claimed only that markets work at least as well as any other solution (and that government regulation works worse, on average).
As far as your specific example, modern advertising, is concerned, I'm not clear about whether you think externalities are significant in this case or not.
...assuming perfect knowledge and the absence of externalities, either of cost or benefit, since (assuming perfect knowledge of costs and benefits) markets optimize the net utility of the direct participants in each exchange, but not net social utility (because externalities are ignored.)