We provide a distributional study of the solution to the classical control problem due to De Finetti (1957), Gerber (1969), Azcue and Muler (2005), and Avram et al. (2007), which concerns the optimal payment of dividends from an insurance risk process prior to ruin. Specifically, we build on recent work in the actuarial literature concerning calculations of the nth moment of the net present value of dividends paid out in the optimal strategy as well as the moments of the deficit at ruin and the Laplace transform of the red period. The calculations we present go much further than the existing literature, in that our calculations are valid for a general spectrally negative Lévy process as opposed to the classical Cramér--Lundberg process with exponentially distributed jumps. Moreover, the technique we use appeals principally to excursion theory rather than integro-differential equations and, for the case of the nth moment of the net present value of dividends, makes a new link with the distribution of integrated exponential subordinators.