A segment tree stores a summary of every block of positions: the leaves hold single values and each parent combines its two children. Any operation that is associative and has an identity works, such as sum with 0, minimum with infinity, maximum, or gcd with 0. A range question then combines O(log n) blocks, and a point update recomputes one path from a leaf to the root.
The bottom-up version fits in a few lines: leaves at n to 2n - 1, parent i = combine(2i, 2i + 1). Use it whenever a Fenwick tree is not enough, because the operation cannot be undone by subtraction (minimum, maximum, gcd) or because you need to search inside the tree, such as the first position whose value is at least x.
When updates cover whole ranges, add lazy propagation: a node covered by an update records the change and passes it to its children only when someone needs them. In interviews, state the combine function and its identity first, then the update and query cost.
A point update recomputes one path from the leaf to the root.