Happiness affects productivity. An unhappy population will idle frequently, decreasing overall production. Some structures increase happiness, such as:
Births and marriages increase happiness, while deaths, sickness, starvation, and freezing will decrease it. A cemetery will reduce the amount of happiness lost when a citizen dies, so long as there is room for a new gravestone.
The more unhappy a citizen is, the longer they will idle for - having very unhappy citizens will lower their effectiveness at their jobs.