In summer, solar heat transfers through the roof into the attic, where it can superheat the air. Even if the attic is well-insulated, that heat can transfer to the living space below, forcing air-conditioning to work harder. Trapped heat also causes shingles to degrade more quickly. In the winter, heat transfers the other way, from the living spaces into the attic and up into the roof. It can melt snow on the roof, which then re-freezes when it reaches the edge of the roof, creating "ice dams" that damage the shingles.
Attic ventilation helps equalize the temperature between the attic and the outside air, minimizing the dangers of trapped heat in both summer and winter.
Outside air enters the attic through the soffit vents, which are installed on the underside of the eaves--the part of the roof that overhangs the sides of the house. Other vents farther up on the roof then allow attic air to escape to the outside.