Context. The second parameter (the first being metallicity) defining the distribution of stars on the horizontal branch (HB) of globular clusters (GCs) has long been one of the major open issues in our understanding of the evolution of normal stars. Large photometric and spectroscopic databases are now available: they include large and homogeneous sets of colour-magnitude diagrams, cluster ages, and homogeneous data about chemical compositions from our FLAMES survey. Aims. We use these databases to re-examine this issue. Methods. We use the photometric data to derive median and extreme (i.e., the values including 90% of the distribution) colours and magnitudes of stars along the HB for about a hundred GCs. We transform these into median and extreme masses of stars on the HB, using the models developed by the Pisa group, and taking into account evolutionary effects. We compare these masses with those expected at the tip of the red giant branch (RGB) to derive the total mass lost by the stars. Results. We find that a simple linear dependence on metallicity of this total mass lost describes quite well the median colours of HB stars. Assuming this mass loss law to be universal, we find that age is the main second parameter, determining many of the most relevant features related to HBs. In particular, it allows us to explain the Oosterhoff dichotomy as a consequence of the peculiar age-metallicity distribution of GCs in our Galaxy, although both Oosterhoff groups have GCs spanning a rather wide range of ages. However, at least an additional-third-parameter is clearly required. The most likely candidate is the He abundance, which might be different in GC stars belonging to the different stellar generations whose presence was previously derived from the Na-O and Mg-Al anticorrelations. Variations in the median He abundance allow us to explain the extremely blue HB of GCs like NGC 6254 (=M 10) and NGC 1904 (=M 79); such variations are found to be (weakly) correlated with the values of the R-parameter (that is the ratio of the number of stars on the HB and on the RGB). We also show that suitable He abundances allow deriving ages from the HB which are consistent with those obtained from the Main Sequence. Small corrections to these latter ages are then proposed. We find that a very tight age-metallicity relation (with a scatter below 4%) can be obtained for GCs kinematically related to the disk and bulge, once these corrections are applied. Furthermore, star-to-star variations in the He content, combined with a small random term, explain very well the extension of the HB. There is a strong correlation between this extension and the interquartile of the Na-O anticorrelation, strongly supporting the hypothesis that the third parameter for GC HBs is He. Finally, there are strong indications that the main driver for these variations in the He-content within GCs is the total cluster mass. There are a few GCs exhibiting exceptional behaviours (including NGC 104=47 Tuc and in less measure NGC 5272=M 3); however, they can be perhaps accommodated in a scenario for the formation of GCs that relates their origin to cooling flows generated after very large episodes of star formation, as proposed by Carretta et al. (2009d).