Personally, I think this is a huge issue. I can't tell you how many times people have shared faith struggles with me, even leading to an eventual loss of faith, which started with prayers for loved ones that went unanswered. Consequently, I really do think there is some pastoral and theological work to be done in putting forward a coherent and helpful theology of petitionary prayer.
So, let us begin with a simple observation: Everyone will die.
Any theology of petitionary prayer has to begin with the recognition that, this side of the eschaton, all our prayers against death will, in the end, go unanswered. We will pray, but everyone dies. That is the truth we need to face before we step into petitionary prayer: We will pray but everyone dies. As creatures we are vulnerable to damage, disease, and decay. Either suddenly or slowly, death will come for us. And while we can pray for healing and recovery as we face these situations, everyone who prays for an ailing loved one will experience the death of that loved one in the face all their prayers. This is the universal experience of petitionary prayer. You will pray for people and they will die.
And yet, God, in Christ, has answered these prayers. Because Christ has defeated death, death is not the final or ultimate word. Without the resurrection of Jesus our prayers against death would be futile and hopeless. Banging our heads against an ontological wall. But as people with Easter hope we know that our prayers against death have been both heard and answered.
My point here is that, until death is finally defeated as our "last enemy," praying against death will be perpetually haunted by the death of those we pray for. Have these prayers gone "unanswered"? Did God not listen to us or care? Did God not act? Such questions suggest to me that we've stepped into petitionary prayer prematurely, with a naive sort of magical and wishful thinking, that we're praying against death without a proper eschatological perspective about what praying against death means for Easter people. To pray against death is this life means we have to understand that death hasn't yet been fully or finally defeated. So when people say, "I prayed so hard for this person and they died," well, that is the experience of petitionary prayer, the quintessential, universal and normative experience of praying against death. Petitionary prayer is an experience of failure. Because everyone you pray for will die.
This is not to deny the possibility of miraculous healing. My goal here isn't to make us fatalistic. Nor can I answer why some people are healed and others aren't. My point is that, when we are praying against death, we have to approach these petitions with an eschatological perspective. We have to know that, in this life, praying against death will be an experience of failure. You need to know that before going in. And yet, we also need to know that this failure isn't terminal or final, that Christ has defeated death. Eschatologically, God has answered every petition for life and healing with a resounding "Yes!" Easter is God's answer to every petition against death. All prayers against death have been answered in the resurrection of Jesus Christ.
Phrased differently, in this life all our prayers against death will be a mixture of lament and hope. Lament for our loved ones who die despite all our prayers. But also hope in the knowledge that death will, one day, be defeated and that, in Christ, every prayer against death was answered on Easter Sunday. This posture of lament and hope is the posture we need to take when we pray against death. The Apostle Paul captures this mixture poignantly in two passages from Romans 8 and 2 Corinthians 4:
For I consider that the sufferings of this present time are not worth comparing with the glory that is going to be revealed to us. For the creation eagerly waits with anticipation for God’s sons to be revealed. For the creation was subjected to futility—not willingly, but because of him who subjected it—in the hope that the creation itself will also be set free from the bondage to decay into the glorious freedom of God’s children. For we know that the whole creation has been groaning together with labor pains until now. Not only that, but we ourselves who have the Spirit as the firstfruits—we also groan within ourselves, eagerly waiting for adoption, the redemption of our bodies. Now in this hope we were saved, but hope that is seen is not hope, because who hopes for what he sees? Now if we hope for what we do not see, we eagerly wait for it with patience. (Rom. 8.18-25)
Now we have this treasure in clay jars, so that this extraordinary power may be from God and not from us. We are afflicted in every way but not crushed; we are perplexed but not in despair; we are persecuted but not abandoned; we are struck down but not destroyed. We always carry the death of Jesus in our body, so that the life of Jesus may also be displayed in our body. For we who live are always being given over to death for Jesus’s sake, so that Jesus’s life may also be displayed in our mortal flesh. So then, death is at work in us, but life in you. And since we have the same spirit of faith in keeping with what is written, I believed, therefore I spoke, we also believe, and therefore speak. For we know that the one who raised the Lord Jesus will also raise us with Jesus and present us with you. Indeed, everything is for your benefit so that, as grace extends through more and more people, it may cause thanksgiving to increase to the glory of God.
Therefore we do not give up. Even though our outer person is being destroyed, our inner person is being renewed day by day. For our momentary light affliction is producing for us an absolutely incomparable eternal weight of glory. So we do not focus on what is seen, but on what is unseen. For what is seen is temporary, but what is unseen is eternal. (2 Cor. 4.7-18)