  We have studied the spin polarization of $\Lambda$ hyperons in heavy ion
collisions at center-of-mass energies $\sqrt{s_{NN}} = 200$ GeV and
$\sqrt{s_{NN}} = 5.02$ TeV carried out at RHIC and LHC colliders. We have
calculated the mean spin vector at local thermodynamic equilibrium, including
all known first-order terms in the gradients of the thermo-hydrodynamic fields,
assuming that the hadronization hypersurface has a uniform temperature. We have
also included the feed-down contributions to the polarization of $\Lambda$
stemming from the decays of polarized $\Sigma^*$ and $\Sigma^0$ hyperons. The
obtained results are in good agreement with the data. In general, the component
of the spin vector along the global angular momentum, orthogonal to the
reaction plane, shows strong sensitivity to the initial longitudinal flow
velocity. Furthermore, the longitudinal component of the spin vector turns out
to be very sensitive to the bulk viscosity of the plasma at the highest LHC
energy. Therefore, the azimuthal dependence of spin polarization can
effectively constrain the initial hydrodynamic conditions and the transport
coefficients of the Quark Gluon Plasma.
