Nematicity and superconductivity: Competition versus cooperation