The last element in the equation: the roof vents, which can be static or mechanical, and should be located as close as possible to the peak of the roof. They finish the job by drawing air—heated in winter, overheated in summer—out of the attic. That air exchange must be calibrated according to the roof slope, among other things.CAA-Quebec - Tips - Ice damming on roofs
If ice is building up on the lower edge of your home’s roof, it definitely shouldn’t leave you cold! These build-ups, called ice dams, can lead to damaging water infiltration if they form on a sloped roof that relies on overlapping components, like shingles or tin, for sheathing. Moreover, icicles that hang from the ice dams at the edge of your roof are a real threat to anyone walking near the house.
Source: Canada Mortgage and Housing CorporationCauses and consequences
Two conditions must be present for an ice dam to form on a roof: a build-up of snow on the roof, and a roof covering that reaches a temperature above freezing. Most often, that warming is caused by heat loss from the house. It can also happen if the outside temperature rises during a warm spell. Snow plus heat: you can guess the rest! The bottom layer of snow, right on top of the roof sheathing, begins to melt. The water then runs down the roof and then freezes once it reaches the roof overhang, which is colder because it is not warmed by the attic (see illustration). This quickly creates an ice dam, which then traps water above it. That trapped water will then have nowhere else to go but into your attic and outside walls. If it does, the damage is done. Insulation, wall and ceiling coverings, paint, masonry—nothing will be immune to deterioration.Breaching the dam
In an emergency situation, the best way to limit damage is to open channels in the ice near the roof edge so that the water can run off. Pouring hot water in the direction in which water normally flows off the roof is the best method. Cutting into the ice with an axe or any other tool that could damage your roof covering is the worst—don’t do it.Keeping ice from forming
There are preventive actions you can take. The most effective ones, however, require a lot of energy. Periodically removing snow from the overhanging parts of the roof is a radical solution, but it tends to be either tiresome, or expensive if you entrust the chore to a specialist. But it will definitely work: no snow means no ice dams! Installing electric heating cables is a proven method. It’s also expensive. You can ensure less complicated and more efficient operation, however, by installing an automated system. This way, the cables will switch on by themselves whenever the conditions are conducive to ice formation (presence of water on the roof and a temperature around the freezing point). The rest of the time, they’ll stay switched off. This ensures that you’ll never leave them on by mistake and waste electricity. Permanent fixes
The wisest solution, of course, is to tackle the problem at its source, and prevent the onset of conditions in your house that will hasten its deterioration. 
The first step is to stop heat migration into the attic. This means adding insulation and/or sealing air leaks, depending where the problem is. The most common places where heat will get into the attic are around the trapdoor and the various elements that pass through the insulated ceilings, such as plumbing and ventilation ducts, recessed lighting fixtures, and chimneys. The appropriate remedies (adding sealant, weatherstripping, expanding foam insulation, etc.) are usually inexpensive and easy to apply. Lastly, your attic must be properly ventilated to ensure that any warm air and humidity that do infiltrate the space are vented to the outside. For starters, there must be inlets for outside air at the base of the roof, which is the reason for having perforated soffits below the overhang. If needed, rigid foam or cardboard deflectors can be installed in the attic, at the base of the roof slope, to ensure that air flows freely between the insulation and the underside of the roof.