Why did the ancient egyptians mummify their dead relatives?

they were mostly buried in pyramids.

So they can live in the afterlife.