The number of ions in a compound depends on the structure of the compound and the oxidation states of the elements within the compound. An element's oxidation state is the number of electrons that an atom possesses or lacks relative to the number of protons in its nucleus. This determines the ionic charge of that atom, which is essential to describing the ionic compounds it forms with other atoms.
Write out the chemical formula for the compound in question.
Identify the polyatomic ions in the compound. Polyatomic ions are ionic molecules made up of more than one atom (often of more than one element). See References for lists of common polyatomic ions and their charges.
Separate the cations and anions. Cations are ions with a positive charge; anions are ions with a negative charge. For example, FeSO4 (iron (II) sulfate) contains an iron cation (Fe2+) and a sulfate anion (SO42-). It is important to note that sulfate is a polyatomic ion, and not a collection of five different ions. The Roman numeral "II" denotes the +2 oxidation state of iron. This allows it to bond with just one sulfate anion.
If a chemical symbol has a subscript associated with it, there are multiple atoms of that element in the compound. Unless they are part of a polyatomic ion, each atom of that element is an individual ion. For example, iron (III) sulfate is written Fe2(SO4)3. The +3 oxidation state of iron requires a different number of sulfates for ionic bonding. In this case, two iron (III) ions will bond with three sulfate ions.
Add the total number of cations and anions. Iron (II) sulfate, for example, has 2 ions: the iron cation and the sulfate anion.
TL;DR (Too Long; Didn't Read)
A comprehensive understanding of oxidation states will help you decode the ionic nature of a compound quickly and with confidence.