Wannano:
Why do prayers for the deceased speed up the time there if a loving God is the only one who knows how much time you need?
Let’s look at the catechism section on Purgatory first, as there is a scriptural basis for this. By prayers, we are making atonement for the dead person’s sins, that the person at that point is not allowed to make.
III. THE FINAL PURIFICATION, OR PURGATORY
1030 All who die in God’s grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.
1031 The Church gives the name Purgatory to this final purification of the elect, which is entirely different from the punishment of the damned.606 The Church formulated her doctrine of faith on Purgatory especially at the Councils of Florence and Trent. The tradition of the Church, by reference to certain texts of Scripture, speaks of a cleansing fire:607
As for certain lesser faults, we must believe that, before the Final Judgment, there is a purifying fire. …
1032 This teaching is also based on the practice of prayer for the dead, already mentioned in Sacred Scripture: "Therefore [Judas Maccabeus] made atonement for the dead, that they might be delivered from their sin."609 From the beginning the Church has honored the memory of the dead and offered prayers in suffrage for them, above all the Eucharistic sacrifice, so that, thus purified, they may attain the beatific vision of God.610 The Church also commends almsgiving, indulgences, and works of penance undertaken on behalf of the dead:
Purgatory is often analogized with the example of a kid who throws a baseball through the window of his family home and breaks the window. The kid then faces his angry father. Kid cries and says he is sorry for breaking the window and won’t do it again. The father, out of love for his child, sets aside his wrath, hugs his repentant kid, and forgives him. This is basically confession and absolution.
However, the kid still has to pay for the new window. This is purgatory.
Think of our prayers as if we donated some money to help pay for the window, thus reducing the amount the kid had to pay - and reducing his time in purgatory.
Another way prayers might work is to make purgatory more comfortable for the person while they are there. So let’s say the kid got a job to make money to pay for the window and he was working really hard and sweating in the hot sun. Our prayers might be as if we brought him a giant size cold Coke with lots of ice. He still has to work (serve time in Purgatory) but he’s not as uncomfortable.
Hope this helps.