The Earth's rotation means that the sun is visible during certain times and blocked during other times. When the sun is visible, it is daytime; when it is blocked, night has come.
In ancient times, people thought that the Earth remained still. To them, the sun appeared to rise and set on a regular but varying basis. Later, astronomers discovered that the Earth orbits the sun and that the Earth rotates in approximately 24 hours. However, the Earth's axis is tilted, which causes days to become longer during parts of the year and shorter during other parts of the year. These fluctuations are fairly small, but they are enough to cause significant temperature variations. These variations create the different seasons.
Day and night also vary based on how close an area is to the equator. Regions close to the equator have only slight variations during the year, so their longest and shortest days are similar in length. Regions far to the north and south of the equator, on the other hand, experience significant variations, and there may be times of the year when the sun never sets or never rises. These variations can cause extreme weather scenarios in these parts of the world.