We consider a general stochastic branching process, which is relevant to earthquakes as well as to many other systems, and we study the distributions of the total number of offsprings (direct and indirect aftershocks in seismicity) and of the total number of generations before extinction. We apply our results to a branching model of triggered seismicity, the ETAS (epidemic-type aftershock sequence) model. The ETAS model assumes that each earthquake can trigger other earthquakes (``aftershocks). An aftershock sequence results in this model from the cascade of aftershocks of each past earthquake. Due to the large fluctuations of the number of aftershocks triggered directly by any earthquake (``fertility), there is a large variability of the total number of aftershocks from one sequence to another, for the same mainshock magnitude. We study the regime where the distribution of fertilities mu is characterized by a power law ~1/mu^(1+gamma). For earthquakes, we expect such a power-law distribution of fertilities with gamma = b/alpha based on the Gutenberg-Richter magnitude distribution ~10^(-bm) and on the increase ~10^(alpha m) of the number of aftershocks with the mainshock magnitude m. We derive the asymptotic distributions p_r(r) and p_g(g) of the total number r of offsprings and of the total number g of generations until extinction following a mainshock. In the regime gamma<2 relevant for earhquakes, for which the distribution of fertilities has an infinite variance, we find p_r(r)~1/r^(1+1/gamma) and p_g(g)~1/g^(1+1/(gamma -1)). These predictions are checked by numerical simulations.