The Earth experiences days and nights as a result of the planet spinning on its axis. As the planet spins, the part that is facing the sun experiences day, while it is night for the part facing away from the sun.
It takes the planet approximately 24 hours to complete one rotation, which is why a day is 24 hours long. However, technically the length of a day is exactly 23 hours, 56 minutes and 4 seconds, which is why leap years are added into the calendar to make up for this difference.
Although the planet always rotates at the same rate, the amount of day and night the area experiences is affected by the tilt of the planet. Areas near the equator always experience an equal 12 hours of light and darkness, while areas further away from the equator experience seasonal changes due to the Earth's tilt.
Summer in the Northern Hemisphere results from this hemisphere being tilted more towards the sun, while winter results when it is tilted away from the sun. This is why the seasons are opposite in the Northern and Southern Hemispheres, as one is always slightly tilted towards the sun and the other tilted away.