How do we explain the fact that cobalt comes before nickel in the periodic table, even though cobalt has a higher atomic mass than nickel?
Cobalt has 1 less proton than Nickel. The extra mass comes from having different isotopes that have more neutrons.
Elements on the periodic table are ordered according to the number of protons an atom of the element has in its nucleus. This is called the atomic number. Cobalt has 27 protons while Nickel has 28 - thus Cobalt is first on the table.
Atomic mass, however, has to do with protons and neutrons. Most elements have several isotopes (forms of an atom with different numbers of neutrons). The atomic mass of an element is the weighted average of the atomic mass of all of its isotopes.* The weighted average of Cobalt's isotopes is slightly larger than that of Nickel's isotopes, so its atomic mass is higher despite having fewer protons.
*For nonradioactive elements such as Cobalt and Nickel. The atomic mass of a radioactive element is the atomic mass of it's most stable/common isotope.