why does iron show a valency of 2 and 3 ?
The electronic configuration of iron is [Ar]4s23d6. It predominantly shows the oxidation state of +2 and +3, which are the most stable oxidation states possible for iron. In the +2 oxidation state, it only needs to lose 2 electrons from the 4s orbital, which will give 6 electrons in the 3d orbital. Thus there are 4 unpaired electrons present in the +2 ion. The +2 state is very stable and exists in the aqueous solutions.
In the +3 oxidation state, there are 5 d electrons present in the 3d orbital. The electronic arrangement will be the one in which each orbital is singly occupied and we know that this arrangement of electrons is very stable, because of high symmetry and exchange energy. Hence Fe primarily forms +2 and +3 oxidation states due to lower energy and extra stability associated with them. Other oxidation states, though formed are not very stable.