What causes some reactions to be exothermic while others are endothermic?
When a reaction takes place there is a change in the reactants, this could be either in terms of a change in phase, or a change in composition. The change alters the inter-molecular and intra-molecular forces.
The total energy that substances have which includes kinetic energy that decides the physical state they are in and the potential energy which is present as inter-molecular and intra-molecular forces is called the enthalpy. If the reaction results in the reactants having a lower enthalpy than the products the reaction is endothermic. An example of this would be the change of ice to water. This requires heat from the environment as water has a greater enthalpy than ice. Another example is the conversion of nitrogen and oxygen to nitrogen oxide.
On the other hand, if the products have a lower enthalpy than the reactants, the reaction is exothermic. For example, when hydrogen burns, the hydrogen and oxygen which combine to give water have a higher enthalpy than water. The decrease in enthalpy is the heat released during the reaction.