Markets are not perfect. They do fail. Every worker isn’t paid exactly what his marginal labor is. Goods and services do carry with them externalities. I’ve never met an economist, regardless of his school of thought, who argues otherwise. But the failure isn’t necessarily a bad thing. In fact, it offers an opportunity for advancement.
All advancement is based off of challenge. To quote Dr. Mordin Solus:
Can’t carry a load, so invent wheel. Can’t catch food, so invent spear. Limitations! No limitations, no advancement.
These limitations, these challenges, are exploited by clever people to make a profit: Man invents spear, trades it to his neighbor, for fresh meat. Or, to bring this into a modern time frame: man noticed workers underpaid. Starts business, offers higher wages. Lures employees from competitors. Makes profit. Or, man notices vehicle emissions harmful. Invents more efficient engine. Sells to companies for royalties. Makes profit.
Any market failure can be (and often is) exploited to make a profit. Their new inventions (which don’t need to be physical, by the way. A process improvement can be an invention, too) help humanity advance.
The ability to make a profit off a market failure is also a barometer of how effective the applied remedy is (and whether or not there is an actual market failure). If an entrepreneur is unable to earn a profit, it’s possible his solution won’t solve the market failure (for example, trying to solve auto emission by selling new steering wheels) or that his perception of the marketplace was wrong (hiring workers at a higher wage but unable to earn profits suggests the workers are paid above their productivity).
When markets are allowed to compete, when this profit motive is allowed to thrive, then market failures, when they do arise, can be corrected. When competition is not allowed, when profit is treated as a curse word, then these failures can become systemic.
One final thought: there are certain types of goods, specifically public goods, where conditions and characteristics are such that it would be extraordinarily difficult for an entrepreneur to correct a market failure. In this case, it may be (and sometimes is) appropriate for government to supply the good/service. But these goods are few in number and the Public Choice Problem remains. One must be very careful when calling for government to fix a market failure.