Ice dam (roof). An ice dam is an ice build-up on the eaves of sloped roofs of heated buildings that results from melting snow under a snow pack reaching the eave and freezing there. Freezing at the eave impedes the drainage of meltwater, which adds to the ice dam and causes backup of the meltwater, which may cause water leakage into the roof and consequent damage to the building and its contents if the water leaks through the roof.

Mechanism

Ice dams occur on heated buildings with sloping roofs in cold climates with deep snow accumulation. Ice dams on roofs form when accumulated snow forms an insulating layer under cold conditions that would cause the freezing point to be within the snow layer, if it were not subject to melting. Instead, building heat coming through the roof's surface melts the snow resting on it. This causes meltwater to flow down the roof, until it reaches below a place on the roof's surface that is below freezing—typically at the eaves where there is no building heat. When the meltwater reaches the frozen surface, ice accumulates, growing a barrier that impedes further passage of meltwater off the roof. Ice dams may result in leaks through the roofing material, possibly resulting in damaged ceilings, walls, roof structure and insulation, or injury when the ice dam falls off or from attempts to remove ice dams.

The melting of roof snow comes from the combination of three basic causes:
Air temperatures well below freezing.
A thick layer of dry snow, which has good insulating capabilities.
Heat from the building coming through the roof.
If any of these factors is absent, ice dams cannot form. Above freezing air does not promote ice dams, nor does granulated spring snow on a roof, which has poor insulating capabilities, nor does a roof that doesn't warm to above freezing at its surface. Ice dams may occur when the under-roof temperature is above  and the outdoor air temperature is below .

Mitigation
Ice dams on sloped roofs can be mitigated in several ways:
Assuring sufficient insulation in the roof to prevent freezing at the roof surface under a deep snow pack.
Providing ventilation under the roofing material that carries escaping building heat elsewhere and assures a cold roof surface. Attic/roof temperatures can be controlled by installing sufficient insulation and providing natural or mechanical ventilation to produce a "cold roof" to keep the roof temperature below .
Providing  heat tape or cables that create channels for meltwater to escape through any ice dam at the eaves. Heat tapes incur energy expense, may cause long-term damage to asphalt shingles, and may present a risk of fire. Some insurance companies do not allow the use of heat tapes due to the fire danger. Ice dams can also form just above the heat tape.
Constructing a roof with a slippery surface that is steep enough for snow to slide off, before it can melt. An ice belt—a band of metal roofing—installed at the eaves helps prevent the formation of ices dams by placing a low-friction surface where ice dams are likely to form.  If an ice dam does form, the ice belt may reduce the penetration of standing water. Metal roofs with adequate roof pitch and minimal valleys are effective at shedding snow.

Removal
When an ice dam occurs there are some maintenance options to remove it:
 Removal of snow from a roof with a special tool called a roof rake. To be successful, the entire roof must be shoveled. Shoveling part way up a roof will cause an ice dam to form at the location where the snow was left, because the meltwater will freeze when it hits the freezing air.
 Removal of ice buildup on a roof can be completed by trained professionals that use special steam equipment to ensure quick and safe removal without causing damage to the roof. Mechanical removal with a hammer, chisel or other tools is likely to damage the integrity of the roof.
 Ice melt socks: A manufactured, permeable material (the sock) filled with ice melt placed on the ice dam will lower the freezing point of the ice, thus causing it to melt.

Leak prevention
Assuring integrity of the roof's waterproofing prevents leaks and consequent damage.
 A roofing membrane, required by building codes in the United States, installed under the roofing material helps prevent leakage from ice damming, but has no effect on the formation of ice dams.

References

Building defects
Roofs
Water ice