Well, you must admit that even within the context of a religious framework, prayer does not seem rational. In fact, it can even appear arrogant.
Take the example of praying for the souls of the dead. In order to make a perfect judgement, you need infinite knowledge, infinite experience and infinite intelligence, all of which God has, and none of which humans have. God has seen every detail of the dead person's life, seen the universe from the beginning, and was intelligent enough to create the universe itself. If a person deserves to go to hell or heaven, God will know, and more significantly, God will certainly not send a person who deserves heaven into hell just because no one prayed or prayed enough for him/her. So if a person is going to hell, then that person must deserve it, and if a person is going heaven, there is no point praying for him/her. Yet, humans presume to petition God for their fate all the same, as they could even come close to being better judges of character than God.
If you're talking about Christianity, it appears that you're quite mistaken about the idea of "praying for the dead" in Christianity.
First of all, only some Christian churches have this idea. The Protestants generally don't believe in praying for the dead, because if people are saved by faith alone, prayers for the dead won't help them get in Heaven anyway.
Catholics believe in the idea, but not as your described it. People whom "prayers for the dead" can affect are people who are going to Heaven anyway, but are still in Purgatory. Catholics believe that Purgatory is a cleansing stage before Heaven, and ALL people in Purgatory are going to Heaven for sure (a mistaken notion is that Purgatory is an intermediate punishment for people who can't go to Heaven yet aren't evil enough to deserve hell -- that's a mistaken notion; Purgatory is a place for the saved, the justified souls who nonetheless are not yet perfected.) Prayers for the dead can help expiate the venial sins and consequences of sins for those in Purgatory.
Hence your statement: "So if a person is going to hell, then that person must deserve it, and if a person is going heaven, there is no point praying for him/her. Yet, humans presume to petition God for their fate all the same, as they could even come close to being better judges of character than God." doesn't apply to Christians in general. You're simply mistaken about Christian beliefs. Your statement might apply to other religions, but I'm not sure.