I think the conflicts always tend to resolve on the side of benefiting users (ads that are relevant to a user's interest, or sponsored search results that are likely what the user is looking for anyway)

We justify advertising because so many of the products and companies we love are built on it, plain and simple. Advertising is "good" in the same sense that pollution is good: in a world without it, much of what we love wouldn't exist. The assumption that Google or Facebook ad revenue reflects value delivered to their users is extremely, extremely dubious, and I don't even see a prima facie case for it. When a rational actor spends money, that's good evidence that it is receiving value, but nobody would model a Facebook user making purchases as a rational actor. If they did, the ads would look rather different. So what basis do we have for saying that effective ads benefit users, except as a way of funding the service by extracting payment from users' attention budgets instead of from their bank accounts?

At one time, people loved seeing smokestacks belching smoke because that meant prosperity, jobs, and abundance. On HN, I think we feel the same way about ads. More effective ads on the web means more prosperity, more employment, and more products for us to enjoy.

Both Google and Facebook were born out of an interest to improve the world and solve a problem

I give credit to Google for having a corporate culture that reflects its founders, but in the long run, survival and profit are more fundamental in a corporation's hierarchy of needs. With Google we probably won't know exactly when it becomes just like AT&T or GM or any other large corporation; we'll recognize it sometime after the fact. Even in their current state, they're still a business with accountants, investors, and quarterly statements. The people who work there are ambitious and want to buy nice stuff; they get goals and reviews and promotions. All the elements that cause corporations to operate at a much lower moral level than the people they're made of are present. The corporate culture can only hold those forces back for so long.

As for Facebook, when did people start regarding them as a benevolent, well-intentioned company (distinct from their great product which really does improve the world?) I knew they were out to change the world and shape the future, but it seemed like improving the world happened as a side effect.

They usually stagnate, alienate their users and only maintain market share by ensuring users have no other choice.

First, you're describing the corporations that emerged victorious from previous great changes; don't underestimate how dominant that behavior can be. Someday, long after Google's "not evil" ethic is no longer an asset they have to lose, standard corporate tactics will be the best way for them to deliver shareholder value. And the shareholders will get their value. Second, it sounds like you're describing Facebook right now. I have Diaspora and Google+ accounts, but of course Facebook is the one I check all the time. Facebook can do almost anything to me and not lose me as a customer, for the simple reason that current social networks don't interoperate and therefore social networking accounts aren't portable from one provider to another in any meaningful way.

EDIT (abusing the edit function to reply): I agree with you that calling Facebook or any other company "malevolent" is incorrect. I think it's better to say that sometimes a company's interests are aligned with the interests of their users, and sometimes they aren't. I also agree that it looks like Google's and even Facebook's interests are aligned with their users' interests in many ways. However, that will change someday, and the very smart guys at Google and Facebook will start acting on that change of interest before we even recognize it.

Also, I really don't see it as them "tricking" us. They aren't doing anything deceitful or morally wrong. They're just doing their job, which is to deliver profitable ad clicks to the advertisers who pay them. We don't have to pretend that they're doing it out of the goodness of their hearts (or that their advertising is good for us) in order to respect what they do and appreciate the service they provide.