If there is more than 4 electrons in the valence shell, the species is likely to accept electrons from other species to form a full valence electron shell.
If there is less than 4 electrons in the valence shell, it is likely that species would lose electrons such that the electrons in the valence shell is all lost and the next inner electron shell becomes the valence shell.
For species with exactly 4 valence electrons, they ate able to gain or lose the 4 valence electrons. However, since losing or gaining 4 electrons requires a large amount of energy, it is not energetically feasible and hence, such species would prefer to share electrons and form a covalent bond.