As (post-)Christian moderns, we are twice handicapped in trying to understand the religions of the ancient pagan states such as Sparta and Rome. Where we tend to think of religious belief as universalistic, other-worldly, monolatrous, and dogmatic, ancient paganism was particularistic, world-embracing, polytheistic (almost ecumenical), and non-dogmatic (but ritualistic).
The nineteenth-century French historian Fustel de Coulanges memorably showed, in his La Cité antique, the fundamental role which the religion had in shaping the laws, families, and very statehood of Greek and Roman societies. The ancient family and state were presided over by fathers also playing the role of priests. Participation in the religion defined who was a member of the community, whether familial or political, what were the inviolable sacred spaces were (the household, the city, the federal sanctuary), what were the duties of each, and who were the ancestors and gods one had to live up to. The religious-familial-political community – all the associated sentiments reinforcing one another in wondrous harmony – and its rules were constantly reinforced by regular and mandatory ritualistic activity featuring sacrifices, a set calendar, festivals, and so on. Coulanges says:
The comparison of the beliefs and laws [of the Greco-Romans] shows that the primitive religion created the Greek and Roman family, established marriage and paternal authority, fixed the categories of kinship, consecrated the right of property and the right of inheritance. This same religion, after having enlarged and extended the family, shaped a wider association, the city, and reigned in it as in the family. 
He stresses furthermore: “There was not a single act of public life in which one did not have the gods intervene.”  This cannot be overemphasized: all ancient Greco-Roman government buildings (including the treasury) were in fact temples. Assembly meetings and court cases were held under the auspices of the gods. Hence, selection of officials by lot was thought to be the gods’ choice and meetings could only be held on propitious religious days. Even on military campaigns, one finds the general acting as head priest, making regular sacrifices to the gods and looking for omens, and making decisions on that basis. Where Christianity has often been separated from the state (“Render unto Caesar . . .”), Coulanges is at pains to emphasize that in pagan Greece and Rome, religion was the state.
We are struck at how “scientific” the Greeks could be. Sophists, historians, and philosophers could explain phenomena in often surprisingly naturalistic and rational ways: that dreams are the return of what concerned us during the day, that the Nile Delta was formed by the river’s steady depositing, or that fossilized shells found in the mountains are proof that the seas used to be high. We find philosophers like Xenophanes criticizing the inherited tales about the gods in a surprisingly free spirit. Then there is Anaxagoras’ memorable claim that the sun was a “a hot stone larger than the Peloponnese”! The historian Thucydides is also remarkable for his lack of religious interpretation.
Yet, these “rationalists” seem to have been very much the exception in these societies, or at least, religious piety and superstition nonetheless dominated daily life. The ancient religion seems to us exceedingly superstitious in many ways. Look at what the most pious Xenophon has his idealized Cyrus say on his deathbed:
Zeus, god of my fathers, and you, O Sun, and all you gods, accept this sacrifice, my offering for many a noble enterprise, and suffer me to thank you for the grace you have shown me, telling me all my life, by victims and by signs from heaven, by birds and by the voices of men, what things I ought to do and what I ought to refrain from. 
We are shocked to see, throughout Greco-Roman history, government and even military business being significantly affected by apparently trivial “omens” such as the weather, the entrails of animals, the flight of birds, dreams, sneezes, the inscrutable sayings of the oracles, to not speak of more significant events such as earthquakes and eclipses. All these were interpreted not as chance occurrences but as manifestations of divine will.
This was not merely a matter of form: one constantly sees ancient generals, say, delaying their action because of a religious festival or because the day’s sacrifice has not yielded an “auspicious” omen (e.g. the Spartans’ not coming to help the Athenians at Marathon, the Athenian Nicias’ passivity in Sicily). We also see religious controversies – such as the vandalization of the Athenian herms or the failure to to recover bodies at the Battle of Arginusae – leading to serious political crises.
On the subjective level, the Ancients experienced the world in a different way from us. Mystery and meaning were everywhere, and that is why they saw “omens” everywhere. On the sociological level, however, the religion clearly served a useful social purpose (otherwise, some tribe of atheists would have conquered their superstitious counterparts, something which never happened until the modern era). 
Requiring all members of the community (family or city) to participate in given rituals and festivals no doubt fostered social unity. If men could agree on the interpretation of an omen, this could create social consensus when a decision had to be made, as the decision was considered to have been made by the gods. These decisions could indeed concern whether to undertake a particular military course of action or whether to launch a colonial expedition. We also witness occasional manipulation of omens for political ends. Wandering “seers” also seem to have used claims of divine insight for economic ends, and were sometimes dismissed as charlatans.
In any event, the piety of ancient societies, and in particular of the most successful states, is beyond doubt. Take Sparta for instance. The Spartans were famously pious and punctilious in respect of ritual. Herodotus says that for them “divine matters took precedence over human ones.”  Xenophon, in his account of the Spartan state, unsurprisingly emphasizes Spartan martial prowess. However, it is after giving an account of the excellence of the Spartans’ rituals while on campaign that he says: “if you witnessed this you would think that militarily others are amateurs, whereas Spartans alone are real masters of the craft of war.”  How telling that the warrior Xenophon reserves the term “craftsmen of war” for experts in religious ritual.
The social sense in this is no doubt in the powerful psychological impact of communal religious ritual in creating feelings of harmony, purpose, and steadfastness. On one occasion, Xenophon says that the Spartans were inspired with confidence, not only by the presence of many weapons in the city, but by the sight of their priest-king:
And here was another sight to warm the heart – the soldiers, with Agesilaus at the head of them, coming back from the gymnasia with their garlands and then dedicating them to Artemis. For where you find men honoring the gods, disciplining themselves for war and practicing obedience, you may be sure that there everything will be full of good hope. 
We emphasize: the sight of and participation in a familiar ritual makes everything “full of good hope.”
Plutarch, in his Life of Lycurgus, attributes a similar role to religious ritual in promoting hope and courage (my emphasis):
Once their phalanx was marshaled together in sight of the enemy, the king sacrificed the customary she-goat, instructed everyone to put on garlands, and ordered the pipers to play Castor’s Air. At the same time he began the marching paean, so that it was a sight at once solemn and terrifying to see them marching in step to the pipes, creating no gap in the phalanx nor suffering any disturbance of spirit, but approaching the confrontation calmly and happily in time to the music. In all likelihood men in this frame of mind feel neither fear nor exceptional anger, but with hope and courage they steadily maintain their purpose, believing heaven to be with them. 
Nor are such comments restricted to Sparta. We find similar observations on Rome, that other very great martial republic of the ancient world. Religious life was just as pervasive in Rome as in Greece. Livy says of Rome: “There was nowhere in this city that was not imbued with religion and which was not occupied by some divinity . . . The gods dwell there.”  Indeed, one has to walk amidst the ruins of the Roman Forum to realize this: one is stunned to see such a concentration of religious-governmental buildings, the inevitable urban overdevelopment produced by a vast empire.
The Greco-Roman historian Polybius, who like Xenophon was also an experienced politician and military officer, explicitly cites religious piety as a fundamental source of Roman power:
But the respect in which, in my opinion, the Roman constitution is most markedly superior is in its view of the gods. It seems to me that superstition, which we criticize in other people, is precisely what gives the Roman state its cohesion. In Rome, nothing plays a more elaborate or extensive role in people’s private lives and in the political sphere than superstition. Many of my readers might find this strange, but it seems to me that it has been done for the sake of the common people. In a state of enlightened citizens, there would presumably be no need for such a course. But since the common people everywhere are fickle – since they are driven by lawless impulses, blind anger, and violent passion – the only option is to use mysterious terrors and all this elaborate drama to restrain them. 
Again, it is striking that Polybius claims that religious piety was the aspect of Rome which was most superior to other states, promoting cohesion and morality among the people. It is also noteworthy that the emperor Marcus Aurelius, whose religious beliefs could be deemed deist or sometimes agnostic, took his role as Rome’s head priest very seriously: the father of the family and the state, by his pious example, shows the way for his flock.
Religion then played a fundamental role in the construction and cohesion of Greco-Roman societies. Religious practice, no doubt, reflects not only custom but deep-seated and inborn human psychological mechanisms, which seek to find meaning in the world and community with others. These mechanisms find their satisfaction through compelling existential narratives and pious rituals in common. The powerful effects are plain for all to see, both in the history of religions, and, for those who have not fully severed themselves from the ancestral ways, in individual experience.
  Fustel de Coulanges, La Cité antique (Paris: Flammarion, 2009 ), 36.
  Ibid., 230.
  Xenophon, The Education of Cyrus, trans. Henry Graham Dakyns (London: J. M. Dent & Sons, 1914), 8.7.3.
  Actually, we should not think that atheistic liberals and communists, when they have engaged in some “crusade,” were not acting in a de facto religious spirit of fanaticism.
  Herodotus, The Histories, trans. Robin Waterfield (Oxford: Oxford University Press, 1998), 5.63.
  Xenophon, Spartan Constitution, 13, in Plutarch, On Sparta, trans. Richard Talbert (London: Penguin, 2005).
  Xenophon, A History of My Times [Hellenica], trans. Rex Warner (London: Penguin, 1966), 3.4.18.
  Plutarch, Life of Lycurgus, 22, in Plutarch, On Sparta.
  Quoted in Coulanges, La Cité antique, 202.
  Polybius, The Histories, trans. Robin Waterfield (Oxford: Oxford World’s Classics, 2010), 6.56.