What factors affect the chemical stability of a compound?
Any change which is spontaneous, takes place to lower the usable energy present in that system (This principle is so important, that even universe obeys it), which depends upon the conditions in which change in taking place. To demonstrate this, lets take an example of a stone at height h, one can do a lot of work with that configuration, it can do work by hitting someone on their head. But in contrast, when it is at ground, it does not do anything much on its own, the reason being it has used up some of its energy stored in the form of gravitational potential energy. Now of course, if conditions change, the stone can again do some work, in fact it is always loosing some of its usable energy energy, in the form of increasing entropy since it is breaking down by the natural forces of wind.
Coming back to your question, why does substitution takes place in case of halo alkane with hydroxide anion. Now, we can see that haloalkane has transformed into an alcohol. If one calculates the usable energy (Gibbs free energy, this encompasses several other factors  which include enthalpy, entropy and thermal energy) stored in haloalkane and corresponding alcohol, it will be clear that usable energy has decreased going from haloalkane to alcohol. To understand more about that, you can look up gibbs energy which quantifies that usable form of energy. Will fluorine bond with fluorine or Cesium- The answer, which I think is obvious to you, is surely cesium. why? Looking at their atoms, imagine cesium has no or very little pull on its valence electrons, while fluorine nucleus has so much pull, that electrostatic force permeates farther than atom. Hence, when two fluorine atoms come close to each other, there is some attraction between both atoms due to their individual pulls, but because both pulls are of same strength, it results in a covalent bond, but in case of cesium, the electrostatic force of fluorine nuclei pulls the valence electrons of cesium taking them away from the cesium nucleus, and thus fluorine's thirst for electrons is satisfied (the rock is at surface now!), while cesium is totally cool about it, since it had very little attraction for those electrons. After this process fluorine has negative and cesium has a positive charge, which attracts both of them and also it decreases the energy stored in fluorine-cesium systemIs CsF so stable that it cannot be dissociated into its components? No its not, put in water and water will dissociate the compound easily and energy is supplied by hydration and increasing entropy.