(actually, protons and neutrons obey the same principle, while photons do not). By ``state'' here we mean a set of properties, such as energy, that characterize an electron.
This principle applies to more complex atoms containing more than one electron. However, in these atoms a complication arises, in that a more rigorous treatment of the problem of an electron orbiting about a proton reveals that, for each value of the integer n of the Bohr model, there can be 2n2 distinct states that a given electron can occupy.
Let us now consider moving up the periodic table. Starting with Hydrogen, we have one electron, which would go in one of the two possible n = 1 levels. For Helium, the next element, we add one more electron, which will go in the second n = 1 level. For the third element, Lithium, we have to add one electron, but the n = 1 level is already filled, so we have to place this electron in the n = 2 level. We can then add more and more electrons to the n = 2 level until the element Neon, which will have 8 electrons in the n = 2 level, which fills that level. The next element, Sodium, will thus have to have one electron in the n = 3 level. And so on.
Although these more complex atoms are much more difficult to analyze than hydrogen, we can see already a particular pattern developing with this simple analysis. The elements Helium and Neon have filled n = 1 and n = 2 levels, or shells, respectively. These two elements are inert gases, which means that they do not bond readily with other elements. It thus seems that the tendency of an atom to bond with other atoms has something to do with the outer electron shell being filled or not (at least for these lower shells - this analysis becomes more complicated for heavier elements).