Most atoms and molecules we encounter are electrically neutral, but ions play an important part in nature. These charged atoms can be positively charged cations or negatively charged anions. Cations and Anions form in different ways. For cations, the loss of an electron leaves them with a net positive charge, whereas for anions, the addition of an electron leaves them with a net negative charge. Understanding the processes behind this, including the ionization energy and electron affinity of different atoms, helps you see why certain atoms become ions more easily than others and what causes it to happen.
TL;DR (Too Long; Didn't Read)
Cations are positively charged ions formed when an atom loses an electron through ionization. The amount of energy required to do this is called the ionization energy
Anions are negatively charged ions formed when an atom gains an electron. The energy in this process is called the electron affinity.
What Is an Ion?
Atoms have three main components: protons, electrons and neutrons. Neutrons are electrically neutral, and although they play an important part in nuclear physics, they aren’t relevant to the formation of ions because they don’t affect the charge of the atom they’re in. Protons are positively charged, and they occupy the central nucleus of the atom along with the neutrons. Electrons are the negatively charged part of the atom, and they occupy a "cloud” around the outside of the nucleus. Electrons and protons have equal but opposite charges, and in the natural forms of elements, there are equal numbers of each in an atom. This means elements are electrically neutral because the charges from the protons and electrons cancel each other out.
An ion is a charged atom. If an atom gains an electron, the negative charge outweighs the positive charge, and the whole atom gains a negative charge. These ions are called anions. If the atom loses an electron, then there is more positive charge than negative charge, and the atom as a whole becomes a positively charged ion. This is called a cation.
How Are Cations Formed?
Cations are formed when a neutral atom loses an electron. Metals are prone to losing electrons as a result of the arrangement of electrons around the nucleus. Electrons occupy different orbitals around the nucleus, and these can be grouped into different energy levels. An electron in an orbital with a high energy level is farther away from the nucleus. Atoms with a full outer energy level are stable, but if there are a small number of electrons in the outer energy level, they are prone to losing electrons. The electrons in the full energy levels “shield” a lot of the positive charge from the nucleus. As a result, the outer electrons are only weakly bound to the nucleus.
Cations are formed by the process of ionization when sufficient energy is given to the electron (by light of a high enough energy, for example) to strip it away from the attraction of the nucleus. The energy required to do this is called the ionization energy. The first ionization energy tells you how much energy you need to remove one electron; the second ionization energy tells you how much is required to remove the second one, and so on.
You can work out the charge on the resulting ion based on the group of the periodic table the element is in. For example, sodium is in group 1, and it forms a cation with a +1 charge. Magnesium is in group 2, and it forms a cation with a +2 charge after losing two electrons to ionization. Aluminum is in group 3 and forms a +3 cation. Group 4 elements don’t form ions, and higher-group elements form anions instead.
How Do Anions Form?
Anions form by the opposite process to cations. Instead of losing an electron, nonmetal atoms can gain an electron. This is because their outer energy level is nearly full. The term electron affinity describes the tendency for neutral atoms to gain electrons. Like ionization energy, it has units of energy, but unlike ionization energy, it has a negative value because energy is released when electrons are added, whereas it is absorbed when electrons are removed.
In general, elements in higher groups (those further to the right on the periodic table) have higher electron affinities, and elements in a higher row of their groups (further toward the top of the periodic table) have higher electron affinities. The decrease in electron affinity as you move down a given column is related to the increased distance between the outer shells and the nucleus, as well as the shielding from the other electrons in lower energy levels. The increase in affinity as you move from left to right is because the energy levels get closer to being fully occupied.
As for cations, the group of the element tells you what charge the corresponding anion will be. The resulting charge is the group number minus eight. Chlorine, in group 7, forms an anion with a −1 charge, and oxygen, in group 6, forms a cation with a −2 charge.