A dead dwarf is placed in his assigned coffin, or a free coffin if one is available.
If a dwarf has friends, they will hold a funeral (party variant) at the coffin. If no friends, the leader will just do his usual "go around consoling everyone". If there's a priest in the fortress, he will trump all other friends / leader and he will hold the funeral instead. This funeral acts as a consolation to reduce the unhappy thoughts regarding the death.
The dwarf in the coffin can be embalmed or mummified any time, requiring a job at the priest's workshop. Embalming requires chemicals made at the alchemist. Mummification requires cloth and either rock salt or limestone.
The magic arc can involve enchanting mummies to help defend the fortress. Embalming might allow creation of zombies and both prevent corpse decay. But you don't need the magic arc to implement priests - we do just fine in real life with priests who cannot call lightning or summon booze.
Additionally, dwarves who have strong personalities would come back as ghosts if left unburied. But some civs prefer embalming, some prefer mummification, and get less of an unhappy thought at the death if the appropriate procedure goes through.
Furthermore, some civs prefer to be buried on a dirt tile, some prefer a stone tile, others must be buried on a grass tile. Maybe require a glass or metal floor?
If these burial procedures are done according to that the civ likes, there's a much lower chance that the ghost will come out and no chance that it'll be angry.