From Wikipedia: "At its peak around 500 BC, Sparta had some 20,000–35,000 citizens, plus numerous helots and perioikoi. The likely total of 40,000–50,000 made Sparta one of the larger Greek city-states; however, according to Thucydides, the population of Athens in 431 BC was 360,000–610,000, making it much larger."
From Quora: "The Spartans had 8,000 Spartiates at the time of the Battle of Plataea"
I was doing some light research for a personal project and was looking into Sparta's population and army size, and these numbers took me off guard and raised a lot of questions in my head.
How could a city with 20,000-35,000 citizens support an army numbering nearly half to a third of their population? How did Sparta function when such a large portion of the male population went on campaign?
How did Sparta rival and cripple Athens, a city approximately ten times their size? How was it that such a population disparity didn't give Athens a massive advantage over the Spartans, even if Spartan soldiers were superior in quality.
It just doesn't seem practical to me that a city that small could consistently support an army that big in the first place, much less that it could then rival Athens and hold such a powerful position in ancient Greece. How was Spartan society structured that this was sustainable?
The basic answer to the question is that the Spartans didn't fight alone. The Peloponnesian War gets its name from the fact that nearly the entire Peloponnese was subjected to Sparta and compelled to fight on its behalf. The Spartans also had alliances with the Boiotians and other peoples of Central Greece. Athens, meanwhile, had arranged its empire in such a way that its subjects paid tribute to finance Athenian campaigns. The result is that Athens fought (largely) by itself against half of Old Greece. It's estimated that the field army of the Peloponnesian League at the start of the war outnumbered the Athenian one by at least 2:1, and possibly a good deal more.
With that out of the way, let's get into some detail.
Population tomfoolery
At its peak around 500 BC, Sparta had some 20,000–35,000 citizens, plus numerous helots and perioikoi. The likely total of 40,000–50,000 made Sparta one of the larger Greek city-states; however, according to Thucydides, the population of Athens in 431 BC was 360,000–610,000, making it much larger.
Wiki is doing some weird stuff here.
First of all, in most cases, our understanding of Greek population figures is based on army numbers, not the other way around. Since all adult male citizens were liable for military service, army sizes are a fair indication of how many grown men there were. From the size of a state's full militia levy we can glean the number of male citizens aged 18-59, from which we can get the full number of male citizens using demographic models; then we double that number to include citizen women. In other words, the numbers you've cited are co-dependent. The estimate that Sparta had 20-35,000 citizens (male and female) at its peak (in the late 6th century BC) is directly derived from the claim that Sparta had about 8,000 adult male citizens at that time. We literally have no other evidence.
A result of this flimsy evidence is that the numbers of other population groups -- in Sparta's case, perioikoi (freeborn non-citizens) and helots -- are actually unknown, and we mostly have to guess. That said, the numbers cited here for Sparta and Athens don't align. The Spartan number seems to reflect only citizens and perioikoi, but not helots. Otherwise the number should be far greater. In fact, it looks to me like it's low-balling the number of perioikoi, of which there were almost certainly more than there were citizens. The Athenian number, meanwhile, does include both resident aliens and enslaved people. In slave societies like those of Ancient Greece, this easily doubles population figures. Exact ratios are unknown because slaves are practically never counted. The Wiki page's source is using some untrustworthy late accounts to estimate the number of slaves in Athens at anywhere between 150,000 and 400,000; if we subtract those, we're left with a more justifiable number of 210,000 for the free population of Athens.
Unfortunately, this is still not a good comparison, because the Wiki article is comparing c.500 BC Sparta with 431 BC Athens. The intervening years saw the rise of the Athenian Empire and an explosion of the Athenian population, while Sparta suffered a disastrous earthquake followed by serious demographic decline. If we had better numbers we might be able to estimate how disparate Athens and Sparta really were at the outset of the war, but Spartan citizen hoplite numbers were certainly much lower than the 8,000 on which the total of 20-35,000 is based. Probably closer to 3,000. This brings us to your other question.
Greek armies are big
One of the most important things to understand about Greek warfare is that there were no standing armies. No Greek state had a professional military. Instead, they relied on the citizen body (and resident foreigners and enslaved people) for their defence. In times of war, the people were called to arms and marched to war with the weapons they could afford. These peasant militias were not particularly organised or skilled, and they couldn't afford to stay out on campaign very long, but they did have one great advantage: numbers.
When you're reading about a Spartan population of 20-35,000 citizens "supporting" an army of 8,000 hoplites, it doesn't mean that a tiny population was somehow producing enough surplus to pay upkeep for a standing army in which 1 in 3 citizens was enrolled. Instead, it means that in a crisis severe enough to require Sparta to call up the whole militia, 8,000 of its citizens were of an age to be liable to serve. In Ancient Greece this age bracket was very wide -- as I said above, all those aged 18-59 were drafted. For most campaigns, the youngest (18-19) and oldest (40-59 or a higher bracket) were kept at home. But if there was an existential threat, say a Persian invasion, these boys and old men would have to march too.
The difference between Athens and Sparta on this point is that Sparta was an oligarchy; it maintained a property requirement for citizenship. This meant in effect that you could only be a full Spartan citizen if you were rich enough not to have to do any work to get by. Only those with large estates farmed by the exploitation of unfree labour could qualify. The entire Spartiate citizen body was a leisure class that could afford hoplite armour and fought as hoplites when called to war. If Sparta were to call up 8,000 citizens, it would field 8,000 hoplites. These men could also afford to stay out on campaign as long as they liked, knowing that their enslaved workforce was doing what needed to be done on their estates. This is why the numbers on the Wiki page are deceptive; they leave out precisely that part of the population that allowed Sparta to field large armies.
In Classical Athens, on the other hand, there was no property requirement for citizenship, meaning not all citizens could afford to fight as hoplites or cavalry. According to the numbers we get from Thucydides, Athens had an army of 23,000 hoplites in 431 BC, but many more citizens were unable to pay for hoplite equipment and served as light-armed troops. There are varying estimates as to how many such people there were, since they're practically never counted, but there were many. For the Delion campaign of 424 BC, the Athenians mustered an army of 7,000 hoplites and more than 10,000 light-armed men. Here we can see the stark difference with Sparta. If Athens were to call up the full levy of 60,000 citizens, it would field 23,000 hoplites, 1,000 cavalry and some 36,000 light-armed. (These numbers are hypothetical, but reflect scholarship's best estimates.) This was the whole citizen population, ranging from wealthy estate owners to wage labourers, shopkeepers, artisans and beggars. They were happy to serve for a few days, but could and would not stay in the field longer than that. When Athens deployed its full levy, it was usually only against neighbouring states.
In practice, then, the Athenian militia that could be used for major campaigns was much smaller. Thucydides says that, when the youngest and oldest men were kept back to guard the walls, the Athenian field army amounted to 13,000 hoplites and 1,000 cavalry (plus 1,200 archers and 200 mercenary horse archers). The great majority of these men belonged to the leisure class, like the Spartiates. An additional few thousand hoplites could be raised from the population of resident foreigners. It was a significantly larger force than the Spartan militia, especially by 431 BC when that force had shrunk to a few thousand; but it certainly wasn't a 10:1 numerical superiority.
Citizens aren't everything
I hope it's clear from the above that it's not actually so simple to translate citizen numbers into applied military power. We have to ask additional questions, such as: how much of the population was in the leisure class? How many could serve as hoplites or cavalry? What sort of campaign are we talking about (close to home or far afield)? Here are just some additional points to consider.
First, the Spartans didn't rely exclusively on their own citizen levy to make up their militia. They also drafted perioikoi and helots. At the battle of Plataiai, Sparta fielded 5,000 Spartiates and 5,000 hoplite perioikoi (and not 8,000 Spartiates as Quora wrongly claims - that number relates to an earlier period). They also fielded 35,000 helots who fought as light infantry. Again, light-armed troops would easily outnumber hoplites in any levy; for Sparta we just need to be careful what part of the militia we're looking at. In the course of the Classical period we see them fielding more and more perioikoi and mixing their levies together in a single formation to hide their falling numbers. This means that even though their citizen numbers were declining rapidly, they could still raise 6,000 hoplites for the battle of the Nemea (394 BC) and an army of some 3,600 hoplites and 700 cavalry around the time of Leuktra (371 BC). For overseas campaigns, they relied more and more on allies, mercenaries and freed helots, so they wouldn't have to risk precious citizen lives.
Second, as I said earlier, the Spartans leaned heavily on their allies. Alone, the Spartans were the strongest state on the Peloponnese, but not by much. With the others together, however, they fielded an unrivalled army, counting more than 30,000 hoplites when it invaded Attika at the beginning of the Peloponnesian War (when only 2/3rds of each state's levy was called up). The larger wars of the Classical period were usually fought between coalitions which banded together to create very large armies, in which the Spartans' declining numbers were less of an issue.
Third -- I'm going over the character limit so I may have to write about the problems of deploying and controlling large armies later. Suffice to say, in the words of the Athenian author Xenophon, "The more soldiers there are, the more mistakes they will make."
EDIT: Don't miss /u/Iphikrates answer below.
Since you indicate that you're doing light research I'll provide a quick and dirty TL;DR answer to your two main questions but I urge you to have a look at the posts I link below because there are some frighteningly knowledgable people here when it comes to Greek history who can provide you with more depth than I could ever hope to.
How could a city with 20,000-35,000 citizens support an army numbering nearly half to a third of their population? How did Sparta function when such a large portion of the male population went on campaign?
Spartan society was built around the concept of Spartan citizens not working. To maintain his status of citizen a Spartan man needed an income to pay his mess fee (basically food and lodging at the barrack he belonged to) which came almost exclusively from land he owned. This land was in turn worked not by the man himself but by his slaves. Because the Spartan men were never really an integral part of the Spartan economy their absence was not keenly felt.
It just doesn't seem practical to me that a city that small could consistently support an army that big in the first place, much less that it could then rival Athens and hold such a powerful position in ancient Greece. How was Spartan society structured that this was sustainable?
I mean in the long term is wasn't sustainable. Low birth rates combined with consolidation of land led to the number of Spartan citizenship steadily declining. So why was Sparta a major player in Greece at all? Because Spartan men were not the only ones who fought for Sparta. Despite pop culture depictions of Spartans as the absolute warrior elite of Greece there is some debate about to what extent Spartan soldiers really differed from their Greek brothers. While being full time soldiers as opposed to militias with little or no regular training had an advantage but for the most part Sparta was powerful because Sparta had allies and helots. Have a look atthis thread by /u/XenophontheAthenian for more information about about the decline of Sparta. There is also this thread by /u/Iphikrates who has corrected me on posts about Sparta more times over the years than I care to count and I'm sure he or Xenophone will have something to say about this response as well.