Repeating failures lead to disappointment. Take any type of personal improvement: sports, fat loss, diets, studies, relationships. Repeating disappointments, if one’s lucky, lead to not treating oneself as important. Thus one’s failures become insignificant, and they don’t get upset anymore.
It’s indeed very difficult to not give up and keep going after one more failure. Hope is endless if there’s enough cause in one’s life. If there’s no cause, no mission, no villain to defeat, then why bother anyway?