This is number 1
in the new Questions you never asked, but now that I mention it, yeah, that's a good point
So, although you probably never thought about it, now that I mention it, yeah, that's a good point. Grass it mostly cellulose. And cows, like us, can't digest cellulose. So where do cows get all their nutrients? They need carbohydrates, proteins, fat, minerals and vitamins.
Cows, like other ruminants (which comes from the word rumen, to which we'll get in a second), have four separate stomach compartments (rumen, reticulum, omasum and abomasum). Other ruminants include elephants and camels. This distinguishes them from non-ruminants, such as pigs, humans and duck-billed platipii, which only have one stomach.
The rumen serves as a fermentation vat where microorganisms, such as bacteria and protozoa, break down the feed (hay, water, saliva, etc.) These microbes break down the cellulose into energy sources that the cow can digest (volatile fatty acids), and build protein, which again, the cow can digest. The rumen is quite huge (about 160 liters), and in an average cow, there are about 100 times as many bacteria as there are humans on earth.
Ruminant animals also regurgitate partially digested stuff and chew on it some more, which is why goats (for example) are often chewing, even when they are not eating.