There is no failure, only feedback
This idea is an often quoted pre-supposition from neuro-linguistic modelling. It's also good old common sense, around for aeons before the early NLPers noticed its value. So how come it's often forgotten.
It's easy to divide experiences up into successes and failures. To have fixed ideas of what we want to have happen, and to perceive any other outcome as lacking, failing, or falling short.
Yes, sometimes there are external criteria that provide a judgement. We can pass or not pass an exam. We can get a job we apply for, or the position may be offered to someone else. We can influence a group to do what we would prefer, or they may choose to go down a different path.
What's important is how we then work with this, and the narrative we build in our mind. What do you make it mean that you did not pass the exam? Is this an opportunity to reflect on your knowledge, study and revision patterns? Or is it a stick to beat yourself with, or yet another example of how life is not fair to you?
Given all meaning is built in the particular context we experience it in, it's important to create space and time in your life to allow reflection and contemplation. It's so very beneficial to step back and consider the different nuances and possible meanings of events, and particularly to decide what feedback you want to take from them, and how you want to respond to this feedback by adjusting your behaviour, habits and ways of making meaning.
Failure, and feedback, are states of mind. Finding one way to not get the outcome you sought is useful information, but only if you learn and choose not to make the same mistake again.
Taking responsibility for your own patterns of behaviour and thought is not always easy. Sometimes patterns are strong, and awareness takes time to build. Sometimes an external perspective is helpful to bring light to how patterns can evolve. If you find yourself stuck in repetitious loops of feeling you fail or life lets you down, then perhaps psychotherapy is for you. If you want to explore it, get in touch.