The alternation between day and night is caused by the rotation of the Earth on its axis. If the Earth did not rotate as it does, the day/night cycle would be very different or possibly even nonexistent. The changing lengths of days and nights depends on your location on Earth and the time of year. Ultimately, these fluctuations are due to the tilt of the Earth's axis and its path around the sun.
Length of a Rotation
The time it takes for the Earth to make a complete 360 degree rotation is approximately 23 hours and 56 minutes. This length of time is called a sidereal day. As the Earth rotates, it also moves in its orbit around the sun. Therefore, when it completes a rotation, the sun is in a different part of the sky. It lags behind the stars by four minutes. Once it reaches the same point in the sky, a solar day will have elapsed. The time of a solar day is 24 hours.
Lengthening and Shortening of Days
While the duration of a solar day is 24 hours, it is not always divided up into 12 hours of day and 12 hours of night. The duration of the day or night varies depending the time of year. The equator is tilted 23.5 degrees from the Earth's orbital plane. Consequently, the Earth's axis is not perpendicular to its orbit. As the Earth moves along its orbit, the orientation of its axis with respect to the sun changes. At certain points in its orbit, the Earth's southern rotational pole is pointing towards the sun. At other points, the Earth's northern pole is pointing towards the sun. This results in changing durations of day and night throughout the year.
The solstices are the positions of the Earth's orbit that mark the longest and shortest spans of daylight hours. The winter solstice in the Northern Hemisphere corresponds to the shortest day of the year, after which daylight hours increase. The summer solstice in the Northern Hemisphere corresponds to the longest day of the year, after which daylight hours decrease. The solstices can also be named for the month in which they occur. For example, the June solstice is the point in the Earth's orbit where the north rotational pole faces the sun. In the Northern Hemisphere, the June solstice is the longest day of the year. In the Southern Hemisphere, the June solstice is the shortest day of the year.
Position on Earth
Your latitudinal position on Earth also determines the number of daylight hours in a solar day. For example, if the north rotational pole is pointing away from the sun and you are in the Northern Hemisphere, the sun will be relatively low in the sky. Consequently, nights will be long and days will be short. When the north rotational pole is pointing towards the sun, the sun will be higher in the sky. Therefore, the days will be longer and the nights will be shorter. The same pattern occurs for the Southern Hemisphere during the opposite times of the year. The extremity of these fluctuations also differs depending on your latitude. The fluctuations in daylight hours are less drastic close to the equator and more drastic close to the poles.