How you think about failure largely determines whether or not you will be successful in the endeavors you pursue.
If you perceive failure as an absolute, as being final, and as the end of the road, that is likely what it will be for you.
With this mindset, when you reach a point of failure, you will not want to go further because you will not be able to imagine it being possible.
If, on the other hand, you perceive failure as simply part of the growth process, as the means by which you learn valuable lessons, and as the jumping off place for bigger and better things, the future will look much different to you.
You will see failure as temporary and it will fuel you to go forward.
Your mindset with regards to failure is what will drive you to either accept your losses as an excuse to give up or to use these losses as the motivation and the education you need to keep going until you succeed.