There are two factors that determine whether a reaction will occur:
Enthalpy (ΔH) is a measure of the amount of heat either gained or lost during a reaction. If a reaction gives off energy (ΔH is negative), the reaction is exothermic and you'll probably feel the energy given off as heat. If a reaction absorbs energy (ΔH is positive), the reaction is endothermic and you'll feel it getting colder as it pulls energy out of your hand).
Entropy (ΔS), on the other hand, measures the change in randomness that takes place over the course of the reaction. You see, the universe likes for things to become more random, so processes with a positive ΔS value are favored, while those with a negative one are not.
As a result, reactions occur when the total energy of the system from both entropy and enthalpy decreases. This total energy is called the free energy, and we denote this with the term ΔG. When ΔG is negative, the reaction is spontaneous. If it's positive, the reverse of the reaction will be spontaneous. If it's zero, you've got yourself an equilibrium.
So, how do we find ΔG? With an equation, of course:
ΔG= ΔH – TΔS
If you put your values of enthalpy and entropy into this equation, as well as the temperature, you can figure out if the reaction will occur spontaneously. (One tip: entropy is usually given in Joules rather than kilojoules as enthalpy is given, so divide that term by 1000 before doing the calculation).
Reference :- http://www.knowswhy.com/why-do-endothermic-reactions-occur/