Here's a video that describes the history of quantum and electron orbitals and configurations a little bit: Crash Course Chemistry: The Electron
If there are more electrons, which orbits do they occupy? In atoms larger than hydrogen, the larger nuclear charge means that the orbits should be closer to the nucleus. If all the electrons are in the lowest energy orbit, even if repulsion expands the orbit a little, then the size of elements would get smaller as they get heavier. Also, it would get harder and harder to pull electrons off heavier elements, because they would be bound much more tightly to the more charged nuclei. Both of these are the opposite of the facts: sizes of elements increase a little as you go down the periodic table, and it is hardest to remove electrons from the lightest elements. Thus, it was clear that only some electrons could be in the lowest orbit.
Pauli was a theoretician "so good that experimental apparatus broke when he walked through the lab door". (It's a joke that theorists, who usually just think, can't handle lab equipment.) He suggested that theory and data would fit well if each orbit (defined by 3 quantum numbers) could hold exactly 2 electrons. Thus as soon as each orbit was full, with 2, the next electron would have to go in the next higher orbit. Using this rule, Bohr and others determined the electron configurations (which electrons were in which state or orbit) of most of the elements, and found that the order matched the periodic table nicely! The movement to the next principal quantum number started a new period, so the theory fit all the data on valence and other properties.
Pauli didn't know at the time why each orbital holds 2 electrons, but later it was found that a fourth quantum number was needed, because strong magnetic fields split the energy of the 2 electrons in one orbit into 2 different levels. (This is the basis of many important experimental techniques, espcially NMR, used by chemists, and MRI, used in medical imaging.) A proposed explanation for this is that the electrons can "spin" in either direction, just like the earth spinning to give us day and night. This isn't exactly what happens, but the word spin is still used to describe this effect. The spin quantum number has values of +1/2 or −1/2. Thus, Pauli's idea is now called the Pauli Exclusion Principle, and it says that no 2 electrons in one atom can have exactly the same quantum numbers. Two electrons can occupy one orbit, but they must have opposite spins.
Bohr figured out the number of electrons in each shell, where a shell is all the electrons with the same principal quantum number. The pattern he used, which you can verify with the periodic table, was 2, 8, 8, 18, 18, 32, 32.
Based on Bohr's model, you can find the number of valence electrons or electrons in the highest shell by looking at the periodic table. (For now, let's not worry about transition metals, and lanthanoides.) Alkalis have 1 valence electron, because we have just started a new shell. Alkaline earths have 2, B has 3, C has 4, N has 5. Chalcogens have 6, halogens have 7, noble gases have 8. (You can see that this is kind of close to the valence we mentioned earlier.