Question about change in pressure and change in temperature for system at equilibrium I was reading my Chemistry textbook and I noticed that it stated that for a system at equilibrium:


At constant temperature, reducing the volume of gaseous equilibrium mixture causes the system to shift in the direction that reduces the number of moles of gas. Increasing the volume will shift the system in the direction of more moles of gas.
If the temperature is increased at equilibrium the system will shift in the direction to consume the heat. If the temperature is decreased, the system will shift in order to produce excess heat.


My question is why does this occur? 

Please answer my questions in terms of how the molecules in the system interact, instead of just saying that what my textbook states is true. 

Also, explain (if possible) using the chemical reaction of N2 (g) + 3H2 (g) ↔ 2NH3 (g), or a similar one.

Why would increasing the pressure cause it to shift in the direction of fewer moles? What, physically, makes the reaction that produces fewer moles favorable?

Also, why would increasing the temperature cause the system to shift to the more endothermic side? What, physically, makes the endothermic reaction more favorable than the exothermic reaction?
For a general idea, see Le Chatelier's principle


  When any system at equilibrium for a long period of time is subjected to change in concentration, temperature, volume, or pressure,
  (1) the system changes to a new equilibrium and 
  (2) this change partly counteracts the applied change.




For the changes of $p, V$, read about equilibrium constant $K$ and Reaction quotient $Q$ and their relation.

Notice, how the Reaction quotient changes with increased pressure/decreased volume, if the reaction increases the molar amount of gases.
And how it changes if it decreases them.

For the former case, increasing pressure increases Q and the equilibrium shifts backwards to make Q  equal to K again.

For the latter case, increasing pressure decreases Q and the equilibrium shifts forwards to make Q equal to K again.



For the temperature effect, see van't Hoff equation:


  $$\frac{d}{dT} \ln K_\mathrm{eq} = \frac{\Delta H^\ominus}{RT^2}$$


Endothermic reaction direction has higher activation energy than the exothermic direction.

As the consequence,

the reaction rate of the endothermic reaction direction

raises with temperature faster

than the reaction rate of the exothermic reaction direction.

Faster endothermic then exothermic reaction means the equilibrium constant shifts at higher temperature in favour of the endothermic reaction.