When I was in my university life, failure was too regular. I could go as far as to say its a semesterly routine. I didnt literally fail any subjects, but I was ranked within the last quarter of my class. Yes, I did my study. Yes, I learned how others did it. But semester after semester, I have became too 'accustomed' in trying and it came to a point where I couldn't connect the dots; I had lost hope. But then I realized.
There was a good lesson in failing. This applies to most pursuit: career, academics, love, hope and fear. The thing is, maybe I worry too much that I might not get what I want (nevertheless it may not be what I need). Thus, I learned this virtue that maybe I have to care less. Care less about failing. Why do I have to be too occupied on the notion of failing such that I have forgotten the feeling of success. And to care less is to stop doubting the pursuit of success.
On another note, when you tried so hard to succeed and you didn't get what you want, unexpected circumstances would be hurtful isn't it? Because you declared a hope and the answer gave no hope. But it all comes down to who's your dependency, who did you rely your hope on, what drives you?
Failure may give you countless repetition of feeling down and it yearns for you to just give up. But what makes the difference is how many times you get up and give it another shot.
Its the same thing with repentance to Allah. Nobody is going to escape without committing a sin. Nobody is going to be the all-perfect, all rounded maksum. But hey, what counts is how many times we look up to God and say, "Oh Allah, would you forgive me again this time?". And when you submit, submit fully. Like any other worldly failure, you will have that feeling "I don't want to but I'm afraid I might fail again in the future". After all, we're insan. But you try. And you try hard. Because success comes by finding the meaning of failure. And that is why we reflect (muhasabah).
Failure is part of the process of becoming. You will be having a bad day but its not a bad life. And hey I'm not saying that we expect failure to come and we dont aim for that but if it does comes knocking on our door, have the right maturity to step up and handle this visitor. Because we know for sure these things come for a visit only for a short while.
And if you fail, know that Allah is greater (Allahuakbar). And whatever your obstacles that you may perceived as too much to handle, Allah is greater. And when you have Allah, you have everything, right?
One day, when we are able to connect the dots, we'll know that wasn't failure. That was just what we needed.