Heat escaping into the attic melts snow on the upper roof, the water refreezes at the cold eave, and the dam backs water under the shingles. The permanent fix is air sealing and insulating the attic plane, not gutters or heat cable.
More detail
Ice dams look like a roofing or gutter problem and are almost always an attic problem, which is why gutter work and heat cable manage the symptom without ending it. The sequence. Warm air leaks from the house into the attic and warms the roof deck. Snow on the warmed section melts. The meltwater runs down to the eave, which overhangs unheated space and stays at outdoor temperature, and refreezes there. The ice ridge grows and traps the next round of meltwater behind it. Standing water then works backward under the shingles, which are designed to shed water running down, not to hold water sitting still, and it enters the house at the top plate or through the ceiling. So the fix is to stop warming the deck. That means air sealing the attic plane first, since leaked air carries the heat, then insulating to the Climate Zone 5A target of R-49 to R-60 depending on the code cycle in force, then confirming the ventilation path from soffit to ridge is clear so any residual heat is carried off. Baffles at the eave keep insulation from blocking the soffit vents, which is a common and self-defeating installation error. What does not solve it. Heat cable melts a channel through the dam and keeps working forever at a running electrical cost, which is a reasonable stopgap on a problem roof and not a fix. Raking snow off the lower roof reduces the material available to freeze and has to be repeated. Larger gutters do nothing, because the dam forms above and behind them. The cost of ignoring it is not the ice. It is the repeated wetting of sheathing, insulation, and drywall, which is how a winter nuisance becomes rot and mold.