The atomic configuration of the first row transition series is....:
$1s^(2)2s^(2)2p^(6)3s^(2)3p^(6)4s^(2)3d^n$
The ionic configuration of the $M^(2+)$ cation is (usually)........
$[1s^(2)2s^(2)2p^(6)3s^(2)3p^(6)3d^n]^(2+)$
The $4s$ electrons are conceived to be removed FIRST upon ionization. And for the explanation, you will have to consult your text. Note that the $3d$ and $4s$ electrons are very close in energy, and their relative energies may change upon ionization.
$Cr^(2+)$ is a notable exception in that its $3d^(5)4s^1$ possesses maximum multiplicity with respect to spin quantum number. Anyway, please consult your text.