Perhaps the oldest role of religious ritual is to win the favor of various gods by feeding them.
In the Hindu tradition [or the Vedic tradition from which modern Hinduism comes], such a ritual is an offering called a “yagya” [elsewhere “yajña”]:
“Through yagya you sustain the gods [elsewhere: demigods] and those gods will sustain you.” 
“The word ‘yagya’ commonly means a religious performance or a holy ritual, a sacrificial ceremony in which gifts are offered to the presiding deity and consumed in fire.” 
“[Yagyas are] Vedic rites performed to please different gods.” 
Why please “the gods?”
Pleasing “the gods” is based on a recognition that natural or personal events in life aren’t an outcome of pure luck or of “natural law;” least of all of naked human effort. Something else — not always clearly definable — is at work, and is ultimately the deciding factor.
The simplest purpose of doing ritual, then, is to win the support of “higher powers” in order to accomplish goals defined by us, ourselves.
The “god” in charge of rain, for example, will only provide that gift if we earn it by our offering.
“The demigods are the empowered administrators of material affairs. The supply of air, light, water and all other benedictions are entrusted to [them]…Their pleasures and displeasures are dependent on the yajñas performed by the human being.” 
Such rituals were also an after-the-fact way of thanking the powers that (seemed to) sustain us. There were serious consequences for not acknowledging the gods’ help, as in Homer’s Iliad:
“[Teukros] … let fly a strong-shot arrow, but did not promise the lord of archery [i.e. Apollo] that he would accomplish for him a grand sacrifice of lambs first born.
He missed the bird, for Apollo begrudged him that […].” 
The yagya/offering was burnt in fire, it’s smoke rising to the sky. It was believed to be thus transformed and transported to the deities.
In Torah, the corresponding term for “yagya” is “korban.” The essential korban consists of meat, bread and wine, as if we’re “giving G-d a meal.” Later Jewish teaching denies this meaning. But its form and ingredients suggest to me that the korban in Torah could have evolved from an earlier practice in which this was its intent.
As mentioned, this type of worship is based on the idea that there’s something more in charge of things than might be visible. There’s something beautiful about this. In its way, it’s heart-felt, without unnecessary intellectualization. We’re offering hospitality, as Avraham did for the three angels; expressing a very warm feeling.
However, even polytheistic traditions consider this level of understanding to be only a first step. Life experience itself — if not prophecy or theological tradition, too — shows worship to be a more complicated matter.
Higher-level understanding begins when we realize that our job is not to get a god (or G-d) to adjust to us. Rather, it’s we who must adjust ourselves to G-d.
So — religious ritual is meant to bring us into harmony with G-d, rather than to bring about any change in G-d’s “behavior” towards us.
Is this “automatic?”
The sacrificial ritual in Torah is fairly clear. Yet, from the prophets’ later critique of sacrifices done in the Beit ha-Mikdash without sincerity — or when unaccompanied by compassion or justice — we can infer that although ritual is meant to bring us into harmony with G-d, it does so only to the extent that it reflects our own ongoing efforts to understand what our relationship to G-d really is and what G-d expects of us — and conform ourselves to that, implementing it in our lives. (This is nowhere truer than at Yom Kippur).
The rabbis arguably based all Jewish “ritual” outside of Torah on the priestly ritual in the Temple mandated in Torah. Thus, the same considerations apply.
Saying the “Shema,” for example, might be a verbal declaration of our belief in “monotheism;” in G-d’s “One-ness.” But if we also believe that “luck,” “natural law” etc., are determining factors in our lives, then our monotheistic declaration doesn’t correspond to our actual belief: “Those who believe that G-d is One, and [also believe] that He has many attributes, declare the [Divine] unity with their lips and assume plurality [i.e. many gods] in their hearts.”  If we recite the “Shema” without some degree of understanding and heart-felt sincerity, it does little or nothing to bring us into harmony with G-d.
There are practices — meditation, for example; especially TM — that can produce experience without requiring belief. But that experience doesn’t replace ritual.
Rather, they should complement each other.