  We study the origin of the step-like shoulder on the high energy side of the
low temperature photoluminescence spectrum of heavily $p$-doped GaAs. We show
experimentally that it is controlled by the Fermi-Dirac distribution of the
holes and by the energy distribution of the photoexcited electrons showing a
sharp step-like dependence. This step is attributed to the percolation
threshold in the conduction band separating localized from delocalized electron
states. A comprehensive set of optical techniques based on spin orientation of
electrons, namely the Hanle effect, time- and polarization-resolved
photoluminescence, as well as transient pump-probe Faraday rotation are used
for these studies. We identify two different electron ensembles with
substantially different spin lifetimes of 20 and 280~ps, limited by the
lifetime of the electrons. Their spin relaxation times are longer than 2~ns.
The relative contribution of short- and long-lived photoexcited electrons to
the emission spectrum changes abruptly at the high-energy photoluminescence
step-like tail. For energies above the percolation threshold the electron
states are empty due to fast energy relaxation, while for lower energies the
relaxation is suppressed and the majority of photoelectrons populate these
states.
