Distribution of meat when animal is sacrificed on behalf of the deceased
People sacrifice animals on behalf of deceased relatives as well. Those whose parents have passed away, they sacrifice animals on behalf of their deceased parents as well. If the sacrifice is done on behalf of the deceased with the intention of gifting the reward to them, even though they had not willed that it should be done, then the way we are ordered to divide the meat into 3 portions, the meat of this sacrifice should also be divided into 3 portions. One part should be distributed among the poor, one among the relatives and one for self. The reward will be for the deceased, but the owner will be the person performing the sacrifice on behalf of the deceased.
If the deceased had willed that animal should be sacrificed on their behalf, then the person performing the sacrifice eat from that meat, but all the meat must be distributed among the poor. As mentioned in Radd Ul Muhtaar:
Translation: The person who is sacrificing an animal on behalf of the deceased should give (some) meat in charity and eat himself as well, the way it is done when sacrificing an animal for oneself. However, the reward is for the deceased and the ownership is of the person making the sacrifice. (Durre Mukhtaar, Vol. 5, Pg. No. 229)
Sadar Shaheed (May Allah shower His mercy on him) has said: The authoritative opinion is if the animal is being sacrificed on the orders of the deceased, then the person performing the sacrifice cannot eat, otherwise he may eat.