For one, failure is a humbling experience. It shows you that you do not know everything, that there is still a lot to learn and you aren't always right. It's easy to get ahead of yourself when you've had a string of successes, but when you then fail you're brought back to the reality that you are not infallible.
With that reminder, you'll learn how to be more flexible in your approach. It gives you the chance to modify and adapt to a less than favourable situation, eventually getting rid of the old approach and coming up with fresh ideas on how you can achieve your goals.
Failure also inspires you to approach things in a different way, meaning you may find alternatives and get creative with how you approach a challenge - giving you a new perspective on the bigger picture.
Failure shows you how resilient you really are and how much you want to achieve something. If failure deters you and forces you to throw in the towel, did you really even want what you strived for? It gives you an insight to your strength and how much you're willing to put in, in order to reach your goals.
Everything you learn from failing gets you ahead in your career because you'll learn what works, what doesn't and how to deal with setbacks the best way.
Serves as reminder that you don't know everything
You're not always right
Makes you become more flexible
Helps you find alternatives that might work better
Show you have resilient you are