Bulk viscosity in relativistic fluids: from thermodynamics to hydrodynamics