The procedure in 1E is really arcane and not clearly explained. See PH p10.
If I read/recall correctly basically each time you get access to a new spell level (including 1st level), you go through that entire spell level in any order you choose, and check whether you can potentially learn each given spell (except Read Magic, which all M-Us automatically start out knowing, and your other three randomly-generated spells in your beginning spell book). Once you hit your Max Spells Known based on your Int score, you stop. If you fail too many rolls and don't meet your Minimum Spells Known then you can re-try failed ones until you hit your minimum, again in whatever order you choose.
If you hit your max spells on your first go through you stop.
If you don't meet your minimum you go through again as you say until you hit your minimum number then you stop.
"Minimum Number of Spells/Level states the fewest number of spells by level group a magic-user can learn. If one complete check through the entire group fails to generate the minimum number applicable according to intelligence score, the character may selectively go back through the group, checking each spell not able to be learned once again. This process continues until the minimum number requirement has been fulfilled.
This means, then, that certain spells, when located, can be learned — while certain other spells can never be learned and the dice rolls indicate which ones are in each category. Example: The magic-user mentioned above who was unable to learn a charm person spell also fails to meet the minimum number of spells he or she can learn. The character then begins again on the list of 1st level spells, opts to see if this time charm person is able to be learned, rolls 04, and has acquired the ability to learn the spell. If and when the character locates such a spell, he or she will be capable of learning it."
It then becomes incoherent because it says immediately thereafter:
"Acquisition of Heretofore Unknown Spells: Although the magic-user must immediately cease checking to determine if spells are known after the first complete check of each spell in the level group, or immediately thereafter during successive checks when the minimum number of spells which can be known is reached, it is possible to acquire knowledge of additional spells previously unknown as long as this does not violate the maximum number of spells which can be known. New spells can be gained from captured or otherwise acquired spell books or from scrolls of magic spells. In the latter event the scroll is destroyed in learning and knowing the new spell or spells."
So if you encounter a new one and have not hit your maximum you can learn it, even though you rolled before that you could not.
Unspecified here whether you need to roll on these newly acquired heretofore unknown spells.
However there's also some implication that you don't actually check for a given spell until you encounter its formula (on a scroll or in a spell book) in play, so the exact timing is a little ambiguous and the DM needs to figure out how they want to run it.
The 1e DMG page 39.
"Thus, if Redouleent the Prestidigitator, intelligence 15, has a repertoire of 7 spells and finds a scroll with yet another, there is a 65% chance that the spell can be understood by that worthy."
Also it is particularly vague on the spell gained at level up and does not specify whether the MU picks the spell or needs to roll to learn it.
"Naturally, magic-user player characters will do their utmost to acquire books of spells and scrolls in order to complete their own spell books. To those acquired, the magic-user will add 1 (and ONLY 1) spell when he or she actually gains an experience level (q.v.)."