The spin of a localized charge carrier in a semiconductor nanostructure can be coherently controlled by external electromagnetic fields. At cryogenic temperatures, the spin coherence time is limited by the hyperfine interaction with surrounding nuclear spins. The generation of tailored nuclear spin states, however, may drastically increase the electron spin coherence in comparison to the disordered nuclear spin system. By means of a fully quantum mechanical description, we investigate two particular nonequilibrium situations in which a highly ordered nuclear spin state is achieved. First, we focus on the formation of the nuclear-spin polaron state under optical cooling of the nuclear spins. Kinetic rate equations are developed that account for different effective spin temperatures of the charge carrier and the nuclei and provide analytical access to the crossover temperature of the polaron formation. The rate equations are generalized to a Lindblad formalism enabling the numerical investigation of a cooled system with arbitrary anisotropic hyperfine interaction. The second nonequilibrium situation addressed in this thesis is the periodic optical excitation of singly charged quantum dots subject to a transversal magnetic field. Nuclei-induced frequency focusing of the electron spin precession leads to mode-locked spin dynamics. A revival of the electron spin polarization directly before each pump pulse reflects this synchronization of the spin dynamics to the pumping periodicity. In experiments, a magnetic field dependence of the emerging revival amplitude is observed. Our quantum mechanical approach allows for attributing this dependence to the nuclear Zeeman term. Moreover, we discuss various additional influences on the mode-locking effect. We examine the effect of static nuclear-electric quadrupolar interactions, the characteristics of the laser pulses, and the choice of the pulse train