Bechorot 49 - Cases of Firstborn Mix-ups and Deaths

If the firstborn son died within thirty days, even if the father had already given the redemption money to a Kohen, the Kohen must return it, because it was given early on the expectation that they child was viable and would survive. If the son died after thirty days, the father must still give the money. If the son died on the thirtieth day, this is a proof that it was not viable, and the Kohen returns the money. Rabbi Akiva is not certain if it is a proof, so if the Kohen got the money, he need not return it, but the father need not give it now.

If a man had two firstborn sons from two wives, and he redeemed the two boys with ten coins, and then one of the boys died, then if he gave all ten coins to one Kohen, the Kohen returns five coins. However, if he gave it to two different Kohanim, then he cannot get his money back, because each Kohen can say that perhaps he got the money for the son that is alive, and it is the other Kohen who got the money for the one who died.

Art: George Frederic Watts - Death Crowning Innocence