When a nucleus captures an electron, a proton changes into a neutron, and an electron-type neutrino is emitted. The atomic number goes down by one unit, accounting for the loss of a proton, and the total number of protons plus neutrons stays unchanged, accounting for the gain of a neutron.
The total mass of the nucleus should go down, however, as the reaction has to be energetically possible. Energy and mass are two names for the same thing (at rest), and to gain mass in this process would violate the conservation of energy. To lose mass allows the neutrino to carry off some energy, or for the newly-formed nucleus to decay down to its ground state by emitting one or more photons. Paradoxically, a free neutron has more mass than a free proton (and even more than a protonís mass plus an electronís mass), but the total energy of a nucleus includes binding energy and kinetic energy of the pieces, in addition to all the rest masses. If a nucleus has lots more protons than neutrons, the protons occupy states in higher-energy shells than the highest-energy neutron. By capturing an electron, a proton can turn into a neutron and fall down to a lower energy state, thus reducing the total mass of the nucleus (but only by a tiny bit!). The total electrostatic energy changes a bit too due to the different number of protons.
If a nucleus is rich in neutrons, then the lowest energy level a neutron can go into will have a high energy, and the nucleus will be unable to capture an electron.
(published on 10/22/2007)