Very very tricksy question for a number of reasons.....
JRRT rarely mentions concrete numbers and if one follows the 'translator conceit' characters might estimate numbers unreliably, except Ghan-buri-Ghan of course.
Middle Earth population density appears to be bizarrely low (see Michael Martinez

) on the other hand, if you happen to be, for example, a peasant of Rohan, you have no option but to become a soldier if the orcs attack. You get the impression that in Medieval or Dark Age times the majority of the population was sensibly uninvolved and uninterested in fighting, for example the English at the battle of Hastings had about 8000 men out of an estimated population of at least 1 million. The likelihood of being eaten by one's opponents would surely ensure greater motivation?
Saying that I shall have a go at a few guesses and comments, based on goldfinger's list
Gondor: 28,000-30,000.
Probably not far out, Bergil or someone critcises the allies for sending about 3000 to Minas Tirith, which is reckoned 'a tithe' of their strength, but is probably exaggerating, so adding in the Minas Tirith forces would bring us back to about this number.
Rohan: 12,000.
There's a reference in HoME to Rohan having 10,000 well armed cavalry and 10,000 infantry and men on ponies (mounted infantry?), so I'd say 20-22,000. The 12,000 refers to the cavalry establishment of Rohan before the War of the Ring and losses at the Fords of the Isen and Helm's Deep.
Elves of Mirkwood: 3-4,000.
Seems logical, guessimated at battle of 5 armies at about 2500, but Thranduil must have left some people at home.
Lorien: 2-3,000.
Gut feeling says a few more than this, on the order of 4-5000, don't know why!
Kingdom of Dale: 3-6,000.
Tricky one, presumably this would include Esgaroth? I'd go for the lower end, say 3000 as they were re-establishing after much destruction etc.
Dwarves of the Iron Hills: 8-10,000.
Following, or in spite of!? the previous comments, I think there are far fewer Dwarves left. They had suffered badly at Nanduhirion and Erebor and multiplied only slowly. Perhaps 2000?
Dwarves of Erebor: 4-6,000.
Again I'd go for a lesser number, perhaps 2000?
Lindon: 2-5,000
Probably lower end again, they will keep on sailing away these elves! Also includes maybe a couple of hundred at Rivendell.
Other places..
The Shire, Bree - lots and lots of hobbits, the question is how 'soldierlike' they were!
Beornings and Woodmen - not very many, maybe 1500 at most?
Evil
Mordor: 100-200,000
At least
Rhun: 14-25,000
Difficult to guess, I wonder what proportion of the Easterlings Sauron deployed to the West?
Harad: 30-40,000
Probably more, including the Corsairs and whoever was left back at Umbar
Khand: 15-20,000
Probably less, doesn't seem like a very fertile sort of place
Goblins of the Misty Mts: 6-10,000
Seems OK
Dol Guldur: 8-10,000
Probably more, it was reoccupied with 'sevenfold strength' before the War of the Ring, maybe 20-30,000
Other places....
Isengard - about 15-20,000 (10,000 orcs are mentioned by Gandalf but there are Dunlendings etc to consider and by Helm's Deep there have been many losses, however Merry and Pippin give 10,000 in all so someone is mistaken here!).
So for the 'good guys' at least I'd go for a very low population but a very high proportion of military service, at least when necessary. For example in Minas Tirith all the men were expected to stay and defend the city. Only a small minority could have been career soldiers, otherwise the economy would have collapsed, but most must have formed some sort of 'citizen militia'.
Anyway thats my pennysworth, I'm off to get some chips