Theory of time-resolved single-molecule fluorescence spectroscopy