We will fail. The test then becomes: how do we react to failure? We can wallow in pity or we can pick ourselves up. If we choose to pick ourselves up, we learn at least two important things.
First, we learn the process of recovery. There are those who fail at an objective and then they fail twice by giving up altogether on achieving the objective. This is, in a sense, a doubling down on failure. Why make your original failure worse by failing again? The more logical approach is to simply try again.
Secondly, before trying again, find lessons in the failure so you can try to avoid it in the future. The stoics suggest daily meditation and daily debriefs. In your daily debriefs, don't be overly critical of yourself. Rather, taking a 'coaching mindset' approach and help yourself by thinking about how you could have done better, what was the cause of the failure, how can you avoid it in the future. Also, praise yourself for the good you've done. Positive praise is often more potent than negative criticism.
One of my favorite movies is Batman Begins; and one of my favorite scenes from that movie is the lesson Bruce Wayne's dad teachings him. "Why do we fall? So we can learn to pick ourselves up!"
(see also Citadel p. 239, 241)