First of all, we have to ask what we mean by failure? Systems don’t fail, they just behave.
Let us define ‘failure’ as causing ongoing harm to particular groups of people, or collapsing.
We might use rates of industrial accidents, or occupational illness, or dumping pollution onto particular populations as initial examples of failure.
Capitalism protects itself against these kind of failures by law and power. If you get injured at work because of ongoing lack of safety, then you have to prove guilt, pay legal fees, and survive with no income. So the employer is pretty safe unless they are small, we get a concerned political party trying to make dangerous working conditions illegal, or you belong to a functional union. This is one reason unions are not popular.
If you are part of a community which gets pollution dumped on it and are poisoned as a result, then likewise you have to prove this in law, and the company probably has the advantage – unless they have done something amazingly and obviously evil, when you might get some media coverage, and they could decide to settle because the bad publicity is costing them profit. As the laws are written by the capitalist class then the probability is high that even if they are found guilty, then the penalty will be minor in terms of the profit gained – at least after they appeal. Or they might simply abandon your town and move somewhere less concerned about pollution. Companies are motile, so they can often destroy ecologies and move elsewhere, leaving surviving residents to deal with the mess. The law and an engineered lack of responsibility helps protect capitalists from failure.
Capitalists may even cheer when the government they own makes it harder to take class actions, or makes it easier to pollute. One of President Trump’s most coherent set of actions has been to make pollution and ecological destruction easier for corporations.
Businesses will often gang up to make sure they don’t all suffer from requirements not to harm people. They will tell us how the proposed restrictions stop economic activity. However, sometimes they will cooperate to make everyone reduce the harm if that harm really looks bad or effects them.
A further way that capitalists protect themselves from this kind of failure is through the institution of the corporation, in which officers of the corporation are rarely at fault for anything, unless it costs shareholders money. Corporations are tools designed to avoid personal responsibility, and give limited liability.
Another way that capitalism can fail is to loose other people’s money.
Bankruptcy is another legal tool whereby capitalists can avoid major responsibility for their debts and loosing other people’s money.
Another tool is government bailouts, as happened in the financial crash of 2008. In this case the debt is transferred from big capitalists to taxpayers. This is particularly good if you can reduce the tax paid by the wealthy and the corporate sector, as then capitalists pay little of the insurance. This process ensures that big capitalists can be protected from their mistakes without suffering any significant consequences. This is good for them, but entrenches mistakes into the system, making it more likely to crash in the future and get more bailout money to keep it going.
You will note that government money was not paid to householders who were losing their houses because of fraudulent loans, so they could pay the debt off; it was transferred directly to the capitalists because the system is set up to protect them, not ordinary Americans. There is some evidence that even when the housing contracts where shown to be fraudulent the judicial system still favoured capitalists. My memory is that when Obama insisted that the companies had to pay back the money there were screams of protests from the Republicans. President Bush had just given them money with no strings attached.
So the biggest way that capitalism avoids failure, for the moment, is to buy access to the State. This is inevitable. In capitalism profit and money are the only significant markers of value, so there is little value to compete with wealth and the ‘class interest’ of the wealthy. The result of capitalism can be called ‘plutocracy’.
Capitalists can make sure politicians need their money to get elected. They can give jobs to politicians for good service after the politician resigns. They can use their media to blacken the names of people who might work against them. They can subsidize Think tanks to provide them with useful ideology and fake ‘facts’ to increase their power and stability. They can try and obliterate facts which are politically inconvenient, although there can be disputes here. For example some capitalists think we need to do things about climate change to survive, and others think we don’t to continue their profit. Neither side will probably support anything that challenges capitalist power or tries to make them responsible for pollution and ecological destruction in our society.
Part of normal capitalist process is to try and take over the State, or to compete in the State for influence and product security. This is how capitalists protect themselves from failure at the cost of ordinary people.