How and why does the body create fever?

Fever happens when the immune system senses a threat such as infection, and pumps out chemicals called cytokines. They, in turn, set in motion a series of chemical reactions that turn up the body’s thermostat.