Failure can be one of two things in my opinion. You can fail when you simply did not do what was necessary, or you can fail when you gave it all you had but it wasn't enough. The response is different in each case, for me.
If I assess the results and determine that the failure was caused by a lack of effort on my behalf, I will give myself the pep-talk required and resolve to not make that same mistake again. I will actively seek to find ways I could have done better, tried harder, given more.
On the other hand, if I conclude that I tried my hardest but still failed, I simply move on. You cannot do more than your best.