After Loius Pasteur discovered heat could kill microbes, it began to be applied to milk around the 1900s, with Chicago leading the charge with a mandate for it in 1908. The motivations for pasteurization of milk was due to a confluence of factors:
At the time, the easiest tool to reach for, and which made a big difference for the milk supply, was pasteurization, and then increasingly widespread refrigeration on top of that made the milk supply much safer again.
Unfortunately, that was also the genesis of the myth that raw milk is inherently unsafe, a position still held by the USDA and many state and local health departments, despite the fact that raw milk, cleanly collected and refrigerated, is statistically nearly as safe as pasteurized milk in the modern era. But at the time, pasteurization was a life-saving change.
Applying heat above approximately 135 F will begin to degrade some components of milk. Particularly it will denature enzymes and proteins (the latter happening closer to 185 F), precipitate calcium and other minerals out of the milk, and weaken the milk's ability to form a curd with rennet mostly due to the loss of free calcium. Some milks such as whole milk sold in the USA will have vitamin D (cholecalciferol) added back into it after pasteurization to compensate for the loss of calcium and to attempt to address other population health issues, similar to how iodine is added to table salt.
When heat is applied, at lower temperatures certain bacteria will begin to die, but at higher temperatures they die faster. There are multiple pasteurization methods for milk based on temperature and time that can be used, depending on how the milk is intended to be used. This same principle applies to pasteurization in general; chicken cooked at 155 F for at least 15 minutes will be as pasteurized as chicken cooked at 165 F for only a few seconds, but the former is more juicy, and the latter more dry.
LTLT (low temperature, long time) pasteurization was the original milk pasteurization method. It calls for holding the milk at 145 F for 30 minutes in order to kill the vast majority of pathogens. It also kills most of the LAB bacteria. Any LTLT pasteurized milk must have cultures added back into it later for cheese and yogurt and so on.
This method is considered the gentlest, and is often preferred for milk intended for cheese making, as it is the most likely to preserve the structure of the milk, its enzymes, and so on. Cheese made with LTLT pasteurized milk will still need calcium chloride added to the milk before coagulation to restore some of the lost calcium and form a good curd.
LTLT pasteurization does not kill all pathogens or even LAB bacteria, but it strongly reduces their counts. It also does not kill clostridia spores (or those of other thermoduric bacteria), so feed contamination with C. botulinum and C. butyrica and C. tyrobutyrica will persist and can still cause late blowing in cheese.
With improved technology, and to speed up the pasteurization process for large dairy producers, HTST (high temperature, short time) pasteurization was introduced and is now the primary milk pasteurization method for what is sold in the grocery stores. It involves running the milk through thin tubes in an environment that is maintained so that the milk reaches 161 F very quickly, holds for 3 seconds or so, and then is rapidly cooled as it passes out the other side. The intention is to minimize the time so as to preserve as much of the structure and properties of the milk, as that temperature is fairly harsh on the milk. Cheese made with LTLT pasteurized milk needs calcium chloride added to the milk before coagulation to restore some of the lost calcium and form a good curd.
Some HTST pasteurization uses higher temperatures (as high as 185 F) for as little as one second, but 161 F for 15 seconds is the typical application.
Like LTLT pasteurization, HTST does not kill everything, and it does not destroy clostridia spores and the like.
UHT (ultra-high temperature) pasteurization is an application of the same principles applied in pressure canning of non-acidic foods: clostridia (and thus botulism, in the clostridia family) spores are not killed at lower pasteurization temperatures, even at boiling temperatures they will survive. They must be heated to above 250 F, usually 275 F, and held for 2-5 seconds in order to destroy the spores entirely. This is the UHT process, and it yields a shelf-stable milk so long as the container itself is also appropriately sanitized or is subjected to the same temperature and then sealed. This is the origin of the shelf-stable boxed milks often seen at schools. UHT milk is able to keep for a long time, even more than a year if kept in good environmental conditions.
UHT pasteurization is, however, very hard on the milk. It denatures likely all of the enzymes, proteins, and destroys the fat/lipid structures, and renders the milk entirely unsuitable for making cheese, as it will not form a good curd, or even form one at all even with calcium chloride added. It may be suitable for yogurt making, however, as that method of thickening the milk benefits from the proteins being denatured.
Typically only cow milk is ever subject to homogenization because the cream separates naturally in cow milk while it stays much more naturally homogenized in other ruminant milk (ewe and goat). Cow milk has fat globules that are much bigger, and are less dense than the surrounding liquid so their surface electrical charges cannot keep them suspended in the milk for very long. Cow milk separates faster at higher temperatures, but even at cold temperatures the fat will rise significantly within even a half hour.
Homogenization is the process of breaking up the fat globules so they are smaller and are able to electrically suspend throughout the milk without boyancy bringing them to the top. Unhomogenized cow milk is sometimes marketed as creamline or cream-top milk. Homogenized milk is usually forced through a plate that has micro-perforations in it that break up the fat globules to be smaller. Unhomogenized milk has to be shaken up prior to pouring to get a proportionate amount of fat in the pour, while homogenized milk does not need this extra step.
Raw-milk advocates argue that the homogenization process damages the fat and has some downsides, such as changes in digestibility or potentially some molecular damage to the fat. Beyond any of this type of damage, it is known that homogenization creates problems in cheese making, where the curds formed are weaker and must be handled with more care. Homogenized milk can be beneficial in that the fat will stay more evenly distributed throughout the curds, rather than some of it rising during renneting and having curds with more fat towards the top of the vat.
Some cheese makers will resort to using pasteurized skim milk, and add heavy cream (which is not homogenized) to avoid weaker curd issues. They will still need to add calcium chloride to strengthen curds due to pasteurization, however.