Failure is a part of life that we have to deal with. Life is far from perfect and we all make mistakes.
I assume you have a recent failure in mind, try and review the situation objectively. Write a list of the points down on paper, such as what failed, was it your fault or someone eles's ?
If it was something you did or did not do that caused the failure, consider why and how you can correct the error.
Don't dwell on it, either you can or you can not do something about it.
If you can... Do it and mark it up as a success.
If you can not... Then you may have to write it off to experience and move on.
But above all Learn all you can from the experience, as I said we all fail sooner or later and it will happen more than once.
Trick is not to fail at the same thing twice.
Hope this helps.