Typo fixed, thanks.
Fair question! It does not explicitly say so here. I infer it from a few things.
1. The phrasing- the magic-user adds the spell. This implies to me that it is a product of their research and study to gain the level.
2. They are not described as being granted one by their master. And in fact there may be no master, as the training rules specify that if you have a performance rating of 1 or 2, or if you've reached name level, you don't need one. Contrast this to 1st level, where the DMG explicitly outlines how to determine which spells their master gave them. And also to B/X, for example, where an MU or Elf is described as always being trained by a higher level master (though B/X specifies that either the player or DM may choose the new spell). If they're not being given one by a master, then I infer that it must be the product of their research.
3. It's also implied by the PH section on % chance to know spells under Intelligence, which tells us under the Chance to Know Each Listed Spell entry (PH 10) that the player selects spells in any desired order to check their ability to learn them.