Not sure how it happens (beyond the obvious of course: e.g. are the parents very critical and demanding, never satisfied, etc.?).
I read somewhere that praising a child (or indeed any person!) for effort and hard work rather than for results in whatever activity (doesn't just have to be academic) can have an important effect on self-esteem, as the individual values their own activity, and not the end result (so, this way children who might not get As, for instance, can be rewarded with praise for the effort they put in, etc.).
Apparently, people who are/were praised in this way, ultimately end up more "successful", as they value hard work, rather than quick results, IYSWIM.
Are the parents giving the child enough 1-to-1 time? Just hanging out, finding out what s/he does and likes, and thinks?