# Why can some ions have different valence?

Like $\ce{Fe}$, it can be $\ce{Fe^{2+}}$ or $\ce{Fe^{3+}}$, same with $\ce{Ni}$ and $\ce{Co}$, what determines whether the ionic compound will be $\ce{Fe^{2+}}$ or $\ce{Fe^{3+}}$?

An empty, half-filled or fully-filled electron shell is especially stable. $\ce{Fe}$ metal is [Ar] 3d6 4s2. $\ce{Fe^{2+}}$ emptiess the 4s-shell. $\ce{Fe^{3+}}$ give that plus a half-filled 3d-shell. Vanadium II, III, IV, V. Now try chloride, hypochlorite, chlorite, chlorate, and perchlorate.
The most stable oxidation state depends on the medium and added ligands, if any. Cu(I) is a Lewis soft acid. It is stabilized by soft bases like pyridine, $\ce{MeCN}$, olefins, $\ce{I^{-}}$. $\ce{Cu^{2+}}$ is a hard Lewis acid. It is stabilized by hard bases like ammonia, water, $\ce{Cl^{-}}$. Dissolve $\ce{CuCl2}$ in pyridine or $\ce{MeCN}$ and you have a powerful oxidizing agent. Dissolve a $\ce{Cu^{1+}}$ salt in water and it disproportionates into $\ce{Cu}$ metal and $\ce{Cu^{2+}}$. Put $\ce{Cu}$ metal and $\ce{Cu^{2+}}$ into $\ce{MeCN}$ and you get $\ce{Cu^{1+}}$.