The short answer is that good mental health is characterized by a lot of positive illusions and self-serving biases and attributions that buttress self-esteem against the impact of failures. People make internal attributions for positive outcomes e.g. "I'm a good player," after a win at a football game and external attributions after failure e.g. "It was raining, it was distracting my play," after a loss. People also tend to overestimate the part of skill in their successes and underestimate how much is up to luck or outside their control. You may think it's a bad thing because the person's perception is distorted in a positive direction. But actually people who have high self-esteem, just by believing they're capable of doing something, adjust their behaviour accordingly and achieve higher performances. People who have low self-esteem, or have low self-esteem because of depression, tend to have more accurate interpretations of self-relevant information, but simultaneously have a hindered capacity to achieve what they want.