Dear Student,
This law is based on the conservation of energy whereby voltage is defined as the energy per unit charge. The total amount of energy gained per unit charge must be equal to the amount of energy lost per unit charge, as energy and charge are both conserved.
Kirchhoff's second law states, "The algebraic sum of the potential differences in a circuit loop must be zero". This in simple language means that, if there is a source (like battery) and couple of impedances (like the resistors, inductors & capacitors) in a closed loop circuit, the voltage supplied by the source is equal to the potential differences across all the other elements. That is to say the voltage supplied is equal to the voltage consumed. So, the energy supplied is equal to the energy consumed. Hence the law of conservation of energy.
Regards