In short you have to believe that you are the best regardless of what the real world feedback is.
Belief in absence of evidence is the very basis of religion , which is something we did ever since the very beginning of the specie, so it is certain that the brain is capable of going that route.
The extra step is to go from belief in absence of evidence (which is typical of religion) to belief in absence of evidence AND also absence of real world positive feedback all around you (which is needed for strong self-belief).
The person who can master this skill is going to have a hell of a good time, the separation between self-confidence and actual real world feedback would be so fundamental and pivotal in humans that it would completely eclipse the separation between Church and State.