We study dynamical phase transitions (DPTs) in quantum many-body systems with infinite-range interaction, and present a theory connecting the two kinds of known DPTs (sometimes referred to as DPTs-I and DPTs-II) with the concept of excited-state quantum phase transition (ESQPT), traditionally found in collective models. We show that DPTs-I appear as a manifestation of symmetry restoration after a quench from the broken-symmetry phase, the limits between these two phases being demarcated precisely by an ESQPT. We describe the order parameters of DPTs-I with a generalization of the standard microcanonical ensemble incorporating the information of an additional conserved charge identifying the corresponding phase. We also show that DPTs-I are linked to a mechanism of information erasure brought about by the ESQPT, and quantify this information loss with the statistical ensemble that we propose. Finally, we show analytically that DPTs-II are forbidden in these systems for quenches leading a broken-symmetry initial state to the same broken-symmetry phase, on one side of the ESQPT, and we provide a formulation of DPTs-II depending on the side of the ESQPT where the quench ends. We analyze the connections between various indicators of DPTs-II. Our results are numerically illustrated in the infinite-range transverse-field Ising model and are applicable to a large class of collective quantum systems satisfying a set of conditions.