Collective effects in many-body systems: the case of quantum batteries and photon condensation