Rerooting DP is an effective technique for tree problems where you need to answer queries for every node as root. You compute the answer for one root, then efficiently update as you change roots. The insight is finding the update formula: what changes when you move the root from parent to child?
This pattern appears in many tree problems: sum of distances, subtree queries, tree DP with changing roots.