The Buddha said that the best gift one can give to one's dead ancestors is to perform "acts of merit" and to transfer these merits to them. The Buddha encouraged those who did good deeds such as giving alms to monks, to transfer the merits to their departed ones. Thus, alms should be given in the name of the deceased by remembering the good things the deceased had done when he was alive. Transferring merits to the deceased is based on the popular belief that after a person has died, his merits and demerits are weighed against one another and his destiny determined. The belief is that the departed one might have gone to the world of the spirits. These beings are not able to generate fresh merits and have to depend on the merits earned in the human realm.
In the Theravada tradition, there is a ritual that is practised. The transferer of merits pours water from a jug into a receptacle, while repeating a Pali formula. This is the translation:
"As rivers, when full flow
and reach and fill the distant main,
so indeed what is given here will
reach and bless the spirits there.
As water poured on a mountain top must soon descend and fill the plain
So indeed what is given here will reach
and bless the spirits there." (Nidhikanda Sutta in Khuddakapatha)
The only way to help the deceased is to do meritorious deeds in memory of them. These acts of merits include: giving dana to ordained people, building schools, temples, orphanages, libraries, hospitals, printing religious books for free distribution, etc. In their state of happiness, the deceased will reciprocate their blessings on the living relatives. Therefore, it is the duty of the relatives to remember their departed ones by transferring merits and radiating loving-kindness directly to them.
(adapted from K. Sri Dhammananda, "What Buddhists Believe")