Experimental and theoretical studies of all-optical spin pump and probe of resident electrons in CdTe/(Cd,Mg)Te semiconductor quantum wells are reported. A two-color Hanle-MOKE technique (based on continuous-wave excitation) and time-resolved Kerr rotation in the regime of resonant spin amplification (based on pulsed excitation) provide a complementary measure of electron spin relaxation time. Influence of electron localization on long-lived spin coherence is examined by means of spectral and temperature dependencies. Various scenarios of spin polarization generation (via the trion and exciton states) are analyzed and difference between continuous-wave and pulsed excitations is considered. Effects related to inhomogeneous distribution of $g$-factor and anisotropic spin relaxation time on measured quantities are discussed.