what determines if the heat of solution is endothermic or exothermic for salts?

Mostly the competition between the lattice energy (how much energy it takes to break the crystalline strucure) vs the heat of solvation of the ions.