Here’s the official version. Never having studied biology, don’t ask me what it means, but it seems like a pretty efficient mechanism. Thank you, mother nature.
“Pus consists of a thin, protein-rich fluid, known as liquor puris, and dead leukocytes from the body’s immune response (mostly neutrophils). During infection, macrophages release cytokines which trigger neutrophils to seek the site of infection by chemotaxis.
There, the neutrophils engulf and destroy the bacteria and the bacteria resist the immune response by releasing toxins called leukocidins. As the neutrophils die off from toxins and old age, they are destroyed by macrophages, forming the viscous pus.” Source.