Throughout the stories of the Middle Earth there are many foods. Which types of food were used the most and who and how do they farm it?
Hobbits had access to a great number of foods, although not enumerated. Bilbo's party ensured the attendees
had a very pleasant feast, in fact an engrossing entertainment: rich, abundant, varied, and prolonged.
We see references to "many farms, cornlands, vineyards, and woods" where the Shire now stood, Farmer Maggot's mushrooms, vineyards, beer (hops) and tobacco, so farmland was definitely plentiful around the Shire.
As for the rest, we don't see much in the way of Gondor's farms as they were to the West of Minas Tirith and not passed through by the Fellowship. There are references to slaves working on Sauron's farms near the Sea of Nurn. The Elves obviously ate lembas as a way-bread, as did the Dwarves with cram, but they also ate normal foods when not travelling. We see trade in barrels between Laketown and the Elves of Mirkwood in the Hobbit, so presumably food may have also been a stock in trade.
Overall this is for us to extrapolate as not much is explicitly detailed in the stories (unlike, say, George R. R. Martin). I'd guess the Hobbits and Men would have had access to most things that would have grown at the appropriate latitudes and climates, while the Elves and Dwarves may have been more creative... or just traded with Men for what they needed.
It's not stated directly but we can make some inferences from what is written.
The presence of beer in the Shire and Bree-land implies that wheat and/or barley were kept as crops. There was also butter, meaning that some form of dairy livestock was kept (which would also provide a source of meat).
In The Two Towers Théoden makes reference to Wormtongue carrying "a sack of meal up into the mountains"; since "meal" in this context means flour, again we have cereal crops being grown.
In Return of the King Denethor speaks of "wine and food", so Gondor has vineyards, as befits it's more southerly latitudes. There are also "white cakes" but there is no indication of whether they are sweet cakes or merely cakes of bread.
Pippin and Beregond eat "bread, and butter, and cheese and apples" which confirm that Gondorian agriculture is also based around cereal crops and dairy produce, with orchards also being present.
There are several references to "kine" (archaic plural for "cow") - Pippin notes that he can see no kine in the Pellenor, and of course "the wild kine of Araw in the far fields of Rhun" - so that confirms that cattle were at least one of the dairy livestock kept (they would also be a source of meat).
In the First Age we note that the Elves of Ossiriand said of Men that "these folk are hewers of trees and hunters of beasts" which at least implies that a more primitive hunter-gatherer lifestyle was led in those times, and we can probably assume that the same applies to some cultures in later Ages.
Overall however, Middle-earth is a single continent roughly the size of Eurasia and Africa together (the Lord of the Rings maps only cover a small north-western portion), so you shouldn't expect there to be a single type of food used in the entire landmass. Foods used will differ as much as those from Mongolia to Iceland.
It's hard to tell which kind of food was used the most, however one food that is constantly mentioned is Lembas.
Lembas is a special kind of bread made by the Elves, waybread in the Common Speech. It is shaped in the form of a cake. It stays fresh for a very long time if not broken and kept in it's leaf-wrappings. One whole cake is sufficient for a full day's march (hobbits sometimes eat one or more). It's recipe is a secret known only by the Elves. Only on very rare occasions is it offered or given to non-Elves.
There is an unofficial recipe here.
I think the best answer to question concerning food in Middle Earth is directing all interested in these matters to read one of the Michael Martinez's essays: "Pasta La Feasta, Baby!" to be found on middle-earth.xenite.org. Food used mainly: cheese, butter, milk, all kinds of meat (from domestic animals to venison, hunting was after all very popular even among elves), bread, vegetables, fruits and many more. I highly recommend to read the essay. You'll see that Tolkien thought of many things to include in his stories (though they are notin the center of attention). Tolkien even felt neccesary to write about money in Middle Earth in one of his notes (about this matter and all kind of economic stuff you can also read in another essay of Michael Martinez "Merchants of Middle Earth").