In the case of stimulated emission we always see that one photon goes into the gain medium and two photons come out. How can this conserve energy?
I believe the key point here is that the electron is already excited. So yes, a photon enters and two leave, but the electron goes from an excited state to a lower energy level.
In a way, you could say that in a photon and an excited electron changes to 2 photons and an electron with lower energy than before.
Hence, conservation of energy!
As far as I understand, an elementary process of stimulated emission includes both emission of an extra photon and a transition of an excited atom (or a molecule) into a state with lesser energy, so the total energy is preserved.
When two photon come out of the atom, the atom goes back to its ground state from an excited state. Therefore energy is not created.