The reason that they have done this (this is a theory created by Egyptologists) is so the dead pharaoh could symbolically climb the sides of the pyramid, make his way to the sky, and live forever. The pyramid also represented the rays of the sun.
Something that is seen through unwillingness