What if you need to answer many queries like "what's the answer if we root at node "? Naive: per query = total. With rerooting: preprocessing, per query. Precompute answers for all nodes with rerooting. Store in an array. Answer queries by lookup.
This pattern works for any associative operation on subtrees. The key is making the "reroot" operation O(). This is a useful technique for turning O(nq) into O(n + q). Precomputation pays off with many queries.