The current cosmological model, the Lambda CDM theory, describes with remarkable precision the assembly and growth of the large scale structures and of the dark matter halos in our Universe. A comprehensive theory for the baryon processes that take place within dark matter halos is, instead, still the subject of active research. The three major ingredients of this theory are known: accretion of hydrogen from the intergalactic medium, star formation, and feedback mechanisms in the form of galactic winds. However, the recipe to blend them together has not yet been found. This thesis focuses on the role that two of these ingredients have in the assembly and evolution of galaxies. The underlying questions that this work aims to address are how the accretion of hydrogen onto galaxies occurs and what the conditions needed to convert this raw fuel into stars are. The instruments used for this investigation are diverse, because of the multiplicity of physical processes, spatial scales, and cosmic epochs involved in the problem. Theory, or more specifically the analysis of hydrodynamic simulations to unveil gas accretion onto high-redshift galaxies, is the starting point for this work. In the second part, spectroscopy of bright quasars is used to probe the physical properties of gas and metals around and within distant galaxies. These observations are systematically compared to model predictions. Deep optical imaging is also used to connect the star formation rates of these galaxies to the gas properties that are measured in absorption. Finally, in the third part, the relationship between hydrogen and star formation on smaller scales is investigated by means of multiwavelength observations of local galaxies. This thesis contributes to the aforementioned open questions in four ways. First, it
is shown that the accretion of gas onto galaxies as predicted by current simulations imprints characteristic signatures on the distribution of hydrogen and metals of a particular family of absorption line systems, the Lyman limit systems. Second, new spectroscopic observations that led to the discovery of gas clouds with physical properties that match predictions from simulations are presented, paving the way for establishing empirically how galaxies acquire their gas. Third, through a comparison of the hydrogen content and the star formation rates of distant galaxies, this thesis confirms how the presence of significant amounts of hydrogen is not a sufficient condition for the onset of star formation. Finally, after assessing the validity of star formation models in environments that are common to high redshift galaxies, these findings have been interpreted as inefficient star formation in regions with low gas column density and low metallicity.