Dr Roel Konijnendijk , aka Iphikrates on the Askhistorians reddit has done quite a few very informative essays on the Spartans. You can find them here:
profiles/iphikrates - AskHistorians
So Spartan military dominance, with the caveat that the Spartan military and the Agoge changed a lot depending on what period of Spartan history you're looking at, can be attributed to these factors.
1. Numbers. The Spartans, at their height, could muster around ten thousand adult, male, propertied citizens between the ages of 20 and 60-something. That was quite large compared to their neighbors and the only city-state that could compete with those numbers in the Classical period was Athens. This let them basically dominate the Peloponnese and let them basically make their entire citizenry a leisure class.
2. Propaganda. Hoplite warfare was in many senses a giant game of chicken, and if you, for whatever reason, think the other guy isn't going to blink first, then you're probably going to want to blink. The Spartans built a reputation for fighting to the death from Thermopylae, and that helped them to win a the psychological battle with other Greeks before the physical battle ever began. Other things also unnerved other Greeks, like pipe music and marching, rather than charging into battle, and that's connected to what's below.
3. They were the
only Greek city-state to have any sort of organized military training. They would have mostly trained in speed and stamina while learning to endure the deprivation of a campaign, so they'd be lean, rather than the steroid giants depicted in 300. Younger Spartans were known to be able to chase down light infantry while in hoplite panoply. They also did basic formation drill, and had more levels of officer- the Athenians didn't have any level of command less than a few hundred men. Thus, the Spartans could actually execute basic battlefield maneuvers more complicated than 'get in a big mass, and charge'. The pipes were to help keep marching rhythm and relay orders, though other Greeks thought the music was there to creep them out.
All of these advantages gradually disappeared in the period between the end of the Pelopenessian War and Philip II. The number of Spartans declined. Their reputation took hit after hit. Other Greek city-states instituted training, and there were mercenary bands that had years of experience fighting together.