I would assume by having parents involved one way or another early on, with things like private, 1:1 education or the parents themselves being researchers
You also need the young person needs to also be extremely motivated and have what it takes. So both the contextual and individual means.
Euler was 41 when he discovered his famous identity, the kind of thing people learn in school.
Even Newton was 21 when he invented calculus, the sort of stuff that you might find late teens learning.
Galois by a couple of years? He died at 20, and I suppose they teach that stuff sometime mid uni?