It must be noted that not every compound in the world is stable, and just because they exist at room temperature does not mean that they will exist at all temperature. This is where thermal decomposition comes in, and this will produce a new compound.
The stability of the compound relates to two factors, the cation and the anion, where the anion is normally a radical ions.
Hydroxides
It must be noted that all group 1 hydroxides are stable while all the other metal hydroxides are unstable and would give water and the metal oxide.
Ca(OH)2 → CaO + H2O
Hydrogen Carbonates
All Hydrogen Carbonates decompose on heating due to the act that these have got an extra water molecule trapped in them. These would give CO2, H2O and a carbonate.
2NaHCO3 → Na2CO3 + CO2 + H2O
Ca(HCO)3 → CaCO3 + H2O + CO2
Carbonates
More over group 2 metals onwards do not even have got stable carbonates, and these would decompose on heating to form an oxide and carbon dioxide.
CaCO3 → CaO + CO2
Nitrates
Nitrates are the most complex group, since all nitrates decompose, but not all groups decompose in the same way. Group one metals decompose to produce nitrites and oxygen while group 2 metals would decompose to produce the oxide together with oxygen and nitrogen dioxide.
Group 1 Nitrates
2NaNO3 → 2NaNO2 + O2
Group 2 Nitrates
2Ca(NO3)2 → 2CaO + 4NO2 + O2
2Mg(NO3)2 → 2MgO + 4NO2 + O2
Ammonium ion
It must be noted that the ammonium ion is not stable, and when this is heated some strange reactions might take place. This is even more true for carbonates and nitrates.
NH4NO3 → N2O + 2H2O
(NH4)2CO3 → 2NH3 + H2O + CO2
Hydrates
Another important group are the hydrates, which are further discussed in the chapter of water. This group covers the water of crystallization, where the water molecules would be trapped in between bigger and larger molecules. this can be removed by heating the compound above 100oC where water would boil off but most of these compounds can easily revert to the hydrated state by taking in water either from the atmosphere or from solution.