Chemical reactions occur when two substances interact to form new compounds or molecules. These processes are ubiquitous in nature and essential to life; NASA's working definition of life, for example, describes it as a "self-sustaining chemical system capable of Darwinian evolution." Several factors determine when and whether a chemical reaction will occur.
When two molecules collide with the right orientation and sufficient force, a chemical reaction may result. Not all collisions cause reactions, however; the atoms or molecules must be able to recombine to form new compounds. Helium atoms, for instance, are inert; they will not react with other gases because their outermost electron shell is already full.
Breaking bonds between atoms takes up energy, while forming new bonds releases energy. If a combination of two atoms has lower energy than the individual atoms, the compound these atoms form is stable. We can use thermodynamics to predict whether such a reaction will occur.
Entropy is a measure of disorder. The Second Law of Thermodynamics holds that the entropy of a closed system can never decrease. If a reaction increases the total entropy of the system and its surroundings, the reaction will be spontaneous. Reactions that are not spontaneous only occur when coupled with a spontaneous reaction, or as a result of doing work on a system (i.e., by expending energy, which causes an increase in net entropy). Consequently, the total entropy of the universe always increases.
As an example, your body powers reactions that are not spontaneous (e.g., protein synthesis) using reactions that release energy and cause a large increase in total entropy (e.g., glucose metabolism).
Total entropy is difficult to measure, so chemists predict whether reactions will be spontaneous by calculating the Gibbs free energy, which they define as the heat absorbed by a reaction at constant pressure, minus the temperature, multiplied the change in entropy of the system. A negative Gibbs free energy indicates a spontaneous reaction.
The fact that a reaction is spontaneous doesn't always mean it happens rapidly. The reactions between the carbon atoms in diamond are spontaneous, but these reactions are so slow that diamonds last a very long time.
Reactions can also reach a state of equilibrium; when two opposite reactions occur at an equal rate, there is no net increase in the amount of the product or the reactants. All of these factors—the change in entropy caused by a reaction, the kinetics of the reaction, and the equilibrium point of the reaction—are important in determining whether a reaction will occur and what it will look like.