Heating a liquid to a controlled temperature for a controlled time kills enough pathogens to make it safe without destroying it. It is among the most effective public health measures ever adopted, it saved enormous numbers of children, and it was resisted for decades.
The work began with a commercial problem rather than a medical one. French wine and beer were spoiling, and Louis Pasteur was asked why.

He showed that fermentation was caused by living microorganisms rather than by a purely chemical process, and that spoilage was caused by different organisms contaminating the batch. Heating the liquid to around 55 degrees killed the spoilage organisms while leaving the drink recognisable, and he patented the process in 1865.
The same experiments demolished spontaneous generation. His swan-neck flasks allowed air to reach a sterilised broth while trapping dust in the curved neck, and the broth stayed sterile indefinitely. Tilt the flask so the broth touched the neck and it spoiled within days. The claim that life arises spontaneously from non-living matter had survived two thousand years and did not survive that.
Pasteurisation is not sterilisation, and the distinction is the whole design.
Sterilisation kills everything, requires higher temperatures, and ruins the taste and nutritional content of most foods. Pasteurisation kills pathogens and reduces spoilage organisms enough to extend shelf life, accepting that some harmless organisms survive.
The standard was set by the most heat-resistant relevant pathogen. For milk that was originally Mycobacterium tuberculosis; when Coxiella burnetii, which causes Q fever, was found to be more resistant, the standard was raised to match it. Everything less resistant dies as a consequence.
Modern methods trade temperature against time. Low temperature long time holds milk at 63 degrees for thirty minutes. High temperature short time, the usual commercial method, uses 72 degrees for fifteen seconds. Ultra-high temperature reaches 138 degrees for two seconds and produces milk that keeps unrefrigerated for months, with a noticeably different taste.

Raw milk was a major route of infection. It transmitted bovine tuberculosis, brucellosis, typhoid, scarlet fever, diphtheria and severe gastrointestinal infection, and infants were the most affected.

Infant mortality in industrial cities was extraordinary by modern standards, and summer diarrhoea was a leading cause. Chicago made pasteurisation compulsory in 1908, New York in 1914, and infant mortality fell substantially in each, alongside other sanitary improvements that make attribution to any single measure imprecise. Bovine tuberculosis in humans, once responsible for a substantial share of childhood tuberculosis, has been nearly eliminated in countries with universal pasteurisation and cattle testing.
Opposition was sustained and came from several directions. Dairy interests objected to the cost. Some doctors argued heating destroyed the milk's nutritional value. And there was a general objection to interference with a natural product.
The nutritional objection has been tested repeatedly. Pasteurisation causes modest losses in some heat-sensitive vitamins, principally vitamin C and some B vitamins, and milk is not a major source of those. Protein, calcium, and fat are essentially unaffected.
The claim that raw milk prevents allergies or asthma comes from studies of farm-raised children, who differ from other children in many ways beyond milk, and the association does not survive as evidence for the milk specifically.
Raw milk consumption continues in several countries, legally in some and not others, and outbreak surveillance consistently finds it responsible for a share of foodborne illness out of all proportion to how little of it is drunk.
Beer, wine, fruit juice, eggs in liquid form, and some cheeses. Almonds are pasteurised in the United States following salmonella outbreaks. Human donor milk for neonatal units is pasteurised, which is one of the clearer illustrations of the risk calculation: the mothers are screened and the milk is still heated.
The principle generalises well beyond food. Apply a controlled dose of a lethal agent, calibrated to the most resistant thing that matters, and accept the survival of everything harmless. That is the logic behind most disinfection standards in use.