Ice dams form at the mercy of environmental factors, including air that is below freezing and a nice thick layer of snow that is settled upon the roof. However, there are steps that can be taken to ensure they do not form or to minimize their formation.
First, increasing and adjusting the amount of insulation in an attic space can help prevent heat loss. You could also consider heat tape (also called heating cables, among other names), which can cause ice dams to melt. However, they’re notoriously ineffective in snowy climates. The cycle of freezing and melting snow can cause ice dams to become even more problematic, damage may incur to shingles, and the risk of electrical fire is elevated with heat cables.
There’s also another solution, but this one often necessitates long-term planning and a bit of budgeting. Upgrading to a more slippery style of roof, like metal roofs, can prevent a thick, fluffy layer of snow from settling on the roof and freezing. Metal roofs often come with a high price tag, but they also have a long lifespan that stretches beyond that of traditional roof styles.