"Every adversity brings with it the seed of an equivalent advantage. Still fewer people know the difference between temporary defeat and failure. Failure is a man-made circumstance. It is never real until it has been accepted by man as permanent. Failure is a state of mind, therefore, it is something an individual can control until he neglects to exercise this privilege." -Napoleon Hill [Outwitting the Devil] pg202
Andrew Carnegie tasked Napoleon Hill to interview the success stories and failure stories of thousands of people. What he found was that all of the major successful people of their time HAD to go through some sort of failure to be able to achieve the height of success that they did. Outwitting the Devil and Laws of Success by N.H are great reads and talk about this a lot.
Failing can lead to success. But in some situations failure is not tolerated. In the military if you completely screw someone over and get them killed you can't exactly just tell your superiors "Oh sorry I'll try better next time!".