For purposes of applying Le Chatelier’s principle, heat (q) may be viewed as a reactant (for example in this endothermic reaction):
$$heat\;+N_2O_4\;(g)⇌2NO_2\;(g)$$
Raising the temperature of the system is akin to increasing the amount of a reactant, and so the equilibrium will shift to the right. Lowering the system temperature will likewise cause the equilibrium to shift left.
For exothermic processes, heat is viewed as a product of the reaction and so the opposite temperature dependence is observed.
However, this simplification does not explain why the reaction shifts (think about it: it’s impossible to add or remove heat from only the products or reactants!) To fully explain the shift, we need to look at the energy and relative rates of the reaction.
The section below goes beyond the minimum knowledge needed for CHEM 203.
Thermodynamic explanation of Temperature & Equilibrium
Consistent with the law of mass action, an equilibrium stressed by a change in concentration will shift to re-establish equilibrium without any change in the value of the equilibrium constant, K. When an equilibrium shifts in response to a temperature change, however, it is re-established with a different relative composition that exhibits a different value for the equilibrium constant.
To understand this phenomenon, consider the elementary reaction
$$A⇌B$$
Since this is an elementary reaction, the rates laws for the forward and reverse may be derived directly from the balanced equation’s stoichiometry:
$$rate_f=k_f[A]$$
$$rate_r=k_r[B]$$
When the system is at equilibrium, $$rate_r=rate_f$$
Substituting the rate laws into this equality and rearranging gives
$$k_f[A]=k_r[B]$$
$$\frac{[B]}{[A]}=\frac{k_f}{k_r}=K_c$$
The equilibrium constant is seen to be a mathematical function of the rate constants for the forward and reverse reactions. Since the rate constants vary with temperature as described by the Arrhenius equation, is stands to reason that the equilibrium constant will likewise vary with temperature (assuming the rate constants are affected to different extents by the temperature change). For more complex reactions involving multistep reaction mechanisms, a similar but more complex mathematical relation exists between the equilibrium constant and the rate constants of the steps in the mechanism. Regardless of how complex the reaction may be, the temperature-dependence of its equilibrium constant persists.
The exact change in equilibrium constant with temperature depends on the enthalpy of the reaction, and is described by the Van’t Hoff equation: $$ln\left(\frac{K_2}{K_1}\right) =\left( \frac{\Delta H}{R}\right) \left(\frac{1}{T_1}-\frac{1}{T_2}\right)$$
Where “1” and “2” mark the two temperature conditions, $\Delta H$ is the reaction enthalpy, T is the temperature in Kelvin, K is the equilibrium constant for the reaction, and R is the ideal gas constant (units of kJ/mol).
You do not need to use the Van’t Hoff equation in CHEM 203 – but knowing the reason for the shift in equilibrium position of a reaction in a truer way than “heat as a reactant” will help you be prepared for future chemistry courses.