Kirchhoff’s loop rule is a direct consequence of conservation of energy. It states that around any closed loop in a circuit, the algebraic sum of all electric potential changes is zero:
A battery contributes a rise in potential if you move from its negative to positive terminal, while a resistor contributes a drop in potential in the direction of current. This rule is especially useful when a circuit cannot be reduced immediately by simple series-parallel methods.
A good calculus way to think about this is through electric potential as an energy function. In electrostatics, the potential difference between two points is path independent, and after moving all the way around a closed loop you return to the same point, so the net change in potential must be zero. In a circuit, batteries and resistors create rises and drops, but the total still sums to zero around each loop. That is the energy bookkeeping statement behind the loop rule.