There seems to be a deep misunderstanding of religion here.
"Prayer is the opening of the heart to God as to a friend. Not that it is necessary in order to make known to God what we are, but in order to enable us to receive Him. Prayer does not bring God down to us, but brings us up to Him"
Just before giving His disciples the Lord's Prayer in the New Testament, Jesus says, "But when ye pray, use not vain repetitions, as the heathen do: for they think that they shall be heard for their much speaking. Be not ye therefore like unto them: for your Father knoweth what things ye have need of, before ye ask him."
Then the prayer itself follows up saying, "After this manner therefore pray ye: Our Father which art in heaven, Hallowed be thy name.Thy kingdom come. Thy will be done in earth, as it is in heaven. Give us this day our daily bread. And forgive us our debts, as we forgive our debtors. And lead us not into temptation, but deliver us from evil: For thine is the kingdom, and the power, and the glory, for ever. Amen."
There's a lot of philosophy tied up in all of that (even for non-Christians). Most people who win the lottery go bankrupt in short order. If you aren't ready for a good thing, it can be destructive. Prayer is an acceptance that God knows what is best for the universe. It helps the person praying to become "in tune" with God's plan and accept that plan no matter if it is personally costly.
As you can see, "Begging for someone's life" is a very different mindset. The change in mindset from prayer's self-reflection can instill a positive outlook which improves medical outcomes. If the outcome is terminal, that same self-reflection can help a person reach acceptance and turn their remaining time into a more positive experience (and help with their loved ones after they have passed away).
That is all true even if there were nobody listening because they believe it to be true.