The cut grass is chopped into even smaller pieces and then compacted to get out as much oxygen as possible (this is important because the microorganisms, called lactic acid bacteria, that are needed to carry out the fermentation like living in oxygen-free environments). Removing and keeping out oxygen is a key part of making silage. This is because fermentation has to happen under anaerobic (oxygen-free) conditions, or the correct type of microorganisms won’t grow.
While oxygen remains, plant enzymes and other bacteria and microorganisms react with the plant sugars and proteins to make energy, reducing the amounts of these nutrients in the grass. Once all of the oxygen is used up, lactic acid bacteria start to multiply. These are bacteria that are needed to make the silage, and they turn the plant sugars into lactic acid. This causes the pH to drop (the mixture because more acidic). Once the pH is around 4-5, the sugars stop breaking down and the grass is preserved until the silage is opened and exposed to oxygen.
If the pH isn’t low enough, a different kind of bacteria will start fermenting the silage, producing by-products like ammonia that taste bad to animals.