Why do certain solutes dissolved in water release heat and other solutes absorb heat?
To understand this phenomenon first we must point out that there are very different solid substances and solvents. Different combinations of them lead to different interactions and properties.
Anyway for the regular case - ionic or soluble compound in water - there is at least two steps to realize the solution:
- Break the solid structure (eg. the crystal lattice). This step generally absorbs energy (endothermic, see lattice energy);
- Solvate the compound. Because there are interactions between matter, the solvent might organize itself around the compound (solvation shell). Those molecules involved are not any more available, they are tied to the compound, they are not any more free water. This step generally releases energy (exothermic, see solvation energy). You can think about this step as a reaction of the solvent to recover form the intrusion by coating the intruder with one or several layers of its molecules. Then it 'feels' if there were only water. You will find details of the complex solvation process in good Physical Chemistry book.
Succeeding these two unit steps leads to dissolution. Solubility is the thermodynamic limit beyond that you cannot dissolve further molecule of a substance. Off course this is related with every substance present in the solution and available free water. Solubility are generally expressed for pure substance only.
When you realize your solution, speaking of heat exchanged with the environment, you experienced the balance between those two reactions. This is why the heat balance can lead to a global endothermic or exothermic reaction.
Enthalpy of hydration is exothermic, Lewis acid-base neutralization. Entropy of dissolution can be either positive or negative. Negative - ordering effect of ion on solvent is greater than the entropy increase of the crystal (highly ordered) lattice breaking down. Positive - increase in entropy because the solvent hydrogen bonding is disrupted. Dissolving KOH is a very large exotherm, Dissolving urea in water is a very large endotherm. This is descriptive and qualitative,
We invite the physical chemists to put a quantitative mathematical model on it.