It's an 'extension' of Le Chatelier's Principle. When you put stress on a system, it tends to go in a direction to relieve the stress.
You only need to know if it is exothermic or endothermic. From there, add in the 'understood' component of heat, and it will be much clearer.
Say you had a reaction A + B --> C which is EXOTHERMIC. Then it produces heat. So the heat will be on the RIGHT side of the equation:
A + B --> C + heat
What happens if you add more of A or B? The equilibrium shifts to the RIGHT because there are more reactants than you originally had in equilibrium. In the same manner, adding more C will shift it to the LEFT. But we can treat heat as an element of the reaction. If you add more heat to this exothermic reaction, it will shift the equilibrium to the left.
The same applies to endothermic reactions:
A + B + heat --> C
This is endothermic as heat is used to produce C. So if we add more heat, the equilibrium will shift to the right.