We know that atoms react to become stable.
Having a charge of 3+ means the atom has 3 excess electrons, likewise, a charge of 2+ means it has two extra electrons from being stable.
If iron with a charge of 3+ reacts with oxygen, we would need 3 atoms of oxygen for the compound to be neutrally charged - stable while iron would need 2. Thus, Iron (III) oxide =
If iron with a charge of 2+ reacts with oxygen, we would need 2 atoms of oxygen and iron for the compound to be stable. Thus, Iron (II) oxide =
When writing chemical formula for compounds with multivalent elements, we use a bracket with roman numerals to indicate which variant the anion reacted with.
E.g. Lead (IV) oxide =
Hope this helps :)