Why do atoms repel when they are close to each other and react when they are far from each other??
It is a matter of:
Atoms are electrically neutral from far away. However, when you (pretend you are another, cognizant atom) get close to one, you are much closer to the electrons (-) than the protons (+). This means that you and the other atom will repel each other.
However, if the atom is missing 1 valence electron to complete its outer 'surface' and you happen to have one too many valence electrons (one of your electrons is further/popped out than all the others), then you two can marry (form a covalent bond) and live happily ever after. You will even produce a baby immediately (the energy/heat/information exchange with the environment when the covalent bond forms).
I know this is all very crude. I hope it helps visualize what's going on and please excuse my terrible humour.
Separate names with a comma.