Failure is the most efficient teacher available to anyone willing to stay in the room long enough to learn what it is actually saying.
The problem is that failure is loud and pride is fragile. Most people leave the room too quickly. They attribute the failure to circumstances, to other people, to bad timing. These things are sometimes true. They are rarely the whole story.
What failure actually teaches depends on how honestly you are willing to look at it. Not in the moment — that is almost never a good time. But a week later, or a month later, when the embarrassment has cooled enough to allow examination.
The questions worth asking are simple. What did I know that I chose not to act on? What did I assume that turned out to be wrong? What would I have needed to know, or do differently, to produce a better outcome? These are not comfortable questions. They are useful ones.
Failure also has a way of clarifying values. When something you worked hard for does not come through, you find out quickly how much you actually cared about it — and whether what you were chasing was genuinely yours or just something that looked right from the outside.
The most useful thing failure can teach you is that you survived it. Not just physically, but in the sense that matters. You are still capable. You still have judgment. You still have the ability to try again with more information than you had before. That is not a small thing. That is the beginning of the next attempt.