When energy is conserved during a process.
Energy is never created or destroyed during any process, it is simply changed from one form to another. Energy is often wasted in the form of heat energy (which is transferred to the surroundings) but it is never simply "lost".