In my master's thesis, which you can find here, I looked at the dynamic problem of an infinitely-lived philanthropist aiming to maximise the expected lifetime of humanity.
In my model, the philanthropist has a given starting endowment and can reduce the extinction rate at every instant by spending on risk mitigation and alternatively invest in a riskless asset to grow her funds. Based on the Hamilton-Jacobi-Bellman equation of the problem, I characterize the optimal spending rate as a function of funds and of time (respectively). I show that optimal spending is zero for low levels of philanthropic funds so that funds grow at the interest rate until reaching a certain threshold. Once funds exceed a certain threshold, the spending rate as a function of time grows at an asymptotically constant rate, i.e. the time trajectory of the spending rate is asymptotically linear. (I do not prove but reasonably conjecture that this is also the case for the spending rate as a function of funds and for funds as a function of time.)
The model is quite limited (it already wasn't easy for me to derive analytical results from this simplistic model). Maybe the most important limitation is the fact that risk mitigation spending only affects the contemporaneous extinction rate but not extinction risk over future periods. This and other limitations probably bias the results toward giving later than would be optimal under a more realistic and more complicated model.
Nonetheless, I post it here in case someone is interested in a starting point for some explicit mathematical reasonning about optimal dynamic philanthropy in the presence of controllable existential risk.
If you find a mistake, please write a comment.