First the element has to be stable. One chooses the easiest way to make the element stable. for example : Al has 13 electrons and you want to make it stable, you consider the outermost electrons where in AL the are three so it is easier for Al to lose three than to gain five