There are two ways to look at equilibrium, both of which end up at the same answer.
The first was is kinetic. Consider the interconversion of molecules A and B. We can look at the reaction this way:
A <--> B
Now, the rate of conversion of A to B depends on the concentration of A and the rate of conversion of B to A depends on the concentration of B. In mathematical terms:
Rforward = kf[A], and
Rreverse = kr[ B ]
Equilibrium occurs when the rate of the forward reaction equals the rate of the backward reaction:
Rforward = Rreverse
kf[A] = kr[ B]
[ B] / [A] = kf / kr
So, the position of the equilibrium depends on the relative magnitudes of the forward and reverse rate constants. From this point of view, equilibrium occurs because at a certain distribution of product and reactant, the excess of product or reactant will balance the inherently higher rate of conversion in one direction.
The second way to look at equilibrium is thermodynamic. A chemical system must try to minimize enthalpy and maximize entropy. In order to minimize enthalpy, the system will favor the more stable chemical species. In order to maximize entropy, the system will tend to favor either the more disordered chemical species or (if the species have approximately equal entropy) a balance between reactants and products. The relationship between thermodynamics and equilibrium can be summarized by this relation (the derivation of which is too long to describe here but can be found in advanced thermodynamics text books):
ΔG = ΔGo + RT ln ([ B]/[A])
where ΔGo describes the change of free energy of the conversion of one reactant to one product, and the RT ln([ B]/[A]) represents the contribution of reactant/product ratios on the entropy of the system. At equilibrium, the free energy is at a minimum. From mathematics, the minimum of a function occurs when the derivative (i.e. change) is zero. In other words, at equilibrium:
ΔG = 0
ΔGo + RT ln ([ B]/[A]) = 0
ln([ B]/[A]) = -ΔGo/RT
[ B]/[A] = exp(-ΔGo/RT)
So, the position of the equilibrium depends on the change in free energy when converting A to B. From this point of view, equilibrium occurs when the entropy gained from having a mixture of A and B balances the free energy contribution of converting the higher energy species to the lower energy species.
The equivalence of these two ways of looking at equilibrium can be shown by deriving the expression for the rate constants (kf and kr) in terms of thermodynamic quantities by using collision theory. The derivation will be found in advanced statistical mechanics books.
I hope this explanation was helpful and wasn't too confusing.