Covalent bonding vs Ionic bonding Why some atoms do ionic bonding (electron gain/lose) over covalent bonding (sharing electrons). Are there some rules/theories which explain that?
 A: Each element has a different electronegativity, which is essentially a measure of how strongly it attracts the electrons in bonds.
If you form a bond between two elements whose electronegativities are very different you will generally end up with an ionic bond, in which the more electronegative atom has a much stronger attraction to the electrons in the bond than the other, and as a result the electron density sits mostly on that atom.
If you form a bond between two elements whose electronegativities are relatively similar you will generally obtain covalent bonds, where the electron density is mostly shared between the two atoms.
Take for instance fluorine, it has the highest electronegativity of any element. This means that fluorine generally dominates other elements in the fight for electron density. Fluorine forms ionic bonds with the less electronegative group 1 and 2 elements. But fluorine also is capable of forming covalent bonds for instance with carbon (eg. $CF_4$) or even the highly unreactive noble gasses.
A: First some preliminary remarks. This is more a chemistry question. Also the difference between covalent bonding and ionic bonding is not so dramatic as it may seem. If you look into charge distributions as a function of distance from the nucleus the difference between ionic and covalent bonding is more subtle than is maybe anticipated.
Now to the question. You can of course explain the behavior with the electronegativity number. However this number itself needs to be explained. Why does fluorine have such a high and sodium such a low electronegativity? The reason is found in the screening of the nuclear potential by the atomic electrons. Full shells are quite efficient at screening. Let's assume, very crudely, that a full shell screens the nucleus perfectly and an incomplete shell not at all. For Na the valence electron feels only a charge of +1. For F the p shell misses on electron. If you add that electron and make F$^-$, this electron will see a charge of +5, as the p shell does not screen at all due to our very crude assumption. So a Na valence electron in NaF likes to spend a lot of time in the available F 2p orbital.
Of course the above assumption is too crude. In reality the screening by a full shell is not perfect, while a nearly full shell will still give substantial screening. Nevertheless a full shell screens better than a nearly full shell and this explains the electronegativity trend on the rows of the periodic table.
