What causes day all night in earth?

The phenomenon of day and night on Earth is caused by the rotation of the Earth on its axis. As the Earth spins, different parts of the planet are exposed to sunlight, creating periods of light and darkness known as day and night. This rotation takes approximately 24 hours to complete, causing the cycle of day and night to occur.