  [Abridged] [...] We study the mass and spin evolution of massive black holes
within a semianalytical galaxy-formation model that follows the evolution of
dark-matter halos along merger trees, as well as that of the baryonic
components (hot gas, stellar and gaseous bulges, and stellar and gaseous
galactic disks). This allows us to study the mass and spin evolution of massive
black holes in a self-consistent way, by taking into account the effect of the
gas present in galactic nuclei both during the accretion phases and during
mergers. Also, we present predictions, as a function of redshift, for the
fraction of gas-rich black-hole mergers -- in which the spins prior to the
merger are aligned due to the gravito-magnetic torques exerted by the
circumbinary disk -- as opposed to gas-poor mergers, in which the orientation
of the spins before the merger is roughly isotropic. These predictions may be
tested by LISA or similar spaced-based gravitational-wave detectors such as
eLISA/NGO or SGO.
