First & foremost, milk that you buy in the grocery store is NEVER allowed to get above 40 degrees from the time it leaves the cow to when you buy it and put it in your cart (that is when your responsibility to put it away in your frig kicks in). The milk supply is always kept refrigerated, and if it should get out of temperature range (due to "frig" malfunction or power outage), it is dumped/removed from the food supply, and the tank sanitized before new milk goes in. In addition, milk comes out of the cow at roughly her body temperature (somewhere near 100 degrees), and it needs to be cooled to below 40 degrees within a certain timeframe. We have several things that help us do that.
First, is a plate cooler. This is process where the warm milk from the cow passes through metal pipes right next to cool water. If you think back to science class, the heat molecules will pass from the warm milk to the cool water, making cool milk and warm water. We reuse the water to provide fresh water to the cows, and the milk starts out cooler when it reaches the bulk tank (our massive "frig"), and requires less energy to get cooled down the rest of the way. The bulk tank has a paddle that swirls the milk to keep cool milk from sitting on the bottom and hot milk on top, so that it cools evenly as it is added to the tank during milk (it also keeps the milk from separating into the cream at the top), and then the compressor (and several other items in relation to that whose names I only know because they have been noted on the numerous bills that have come in recently due to their necessary repair) work to cool the milk in the tank, just like a refrigerator or freezer in your house. We replaced our bulk tank recently to get one with a better cooling system and it's bigger to keep up with the higher volume of milk are cows are (and will be) producing!
I've gotten into more of a habit as of late when I do the last feed push-up & maternity check to not only see if the "light is on", but also to check the temperature gauge on the bulk tank, just to make sure it is cooling like it should. And, there are people "on call" 24/7 at our service company to come and help diagnose and fix any problems that we can't handle ourselves. (which I'm sure they loved the 9 PM trip last Sunday night, but it saved a load of milk!)
When the milk truck picks up each morning, the driver first checks the temperature and for any smells or odors that tell them that something isn't right. If they suspect issues, they call in the producer and our cooperative before they will load it on the truck (and thus, potentially contaminate any neighbor's milk that might already be loaded). Any suspect loads are dumped, which as a producer, isn't a whole lot of fun for us (no milk = no paycheck), but it is MUCH more important that safe food arrive at your dinner table (and mine).
So, no smells of rotten milk on the farm, and you can rest assured of all the work that goes into getting you a COLD glass of milk!