Without energy input chemical reactions always proceed towards equilibrium. For a reaction
equilibrium occurs when
where K is a constant called the equilibrium constant. The left side of the equation is called the mass action expression and is denoted Q for a generic state (not necessarily in equilibrium). For a single-step reaction, this can easily be derived just by considering the kinetics involved. Unlike rate equations, though, it still holds for multi-step reactions since the expressions for each step just multiply together. This, by the way, also gives us the relationship between equilibrium and temperature:
where ΔE is the difference in energy per mole between reactants and products, e is the base of the natural logarithm, and R is the molar gas constant. The constant is mainly influenced by entropy change, but that's a little more complicated - whereas energy is roughly constant against concentration, entropy varies logarithmically so we have to refer back to a particular state. The relationship makes the most sense in terms of the free energy difference, ΔF* = ΔE - TΔS*, which represents the total work that can be done by the system as it develops. At equilibrium ΔF = 0, which gives us
Very often we consider the standard state, where Q = 1 in appropriate units, which can then be neglected. Note that all this applies to a reaction at constant temperature only. For a reaction at constant pressure (which is actually somewhat more typical) you would use the Gibbs free energy, ΔG* = ΔH - TΔS*, where ΔH is the change in enthalpy.