We have discussed the doomsday argument in an earlier thread. I showed it to be at least slightly optimistic. I will assume the probability of the population reaching a certain amount is inversely proportional to the square of the amount. It should be sufficiently pessimistic.

Given that, assuming there's a total of 50 billion people, that means that there's a one-in-four chance of there being another 50 billion people, one-in-nine of being another 100 billion, and so on. If the population stabilizes at 10 billion, with a life expectancy of 80 years, that's increments of 400 years. There would be a 1% chance of humanity surviving another 3600 years. Assuming the interest rate stabilizes at 1% above the general economic growth, that would increase your donation by a factor of a little over a quadrillion.

We also have to factor in that the same charities won't be around, of course. For example, microcredit is self-perpetuating. After a certain amount of time, they will have enough donations, and anything more people do for them will be useless. Even so, it seems unlikely that there won't be a charity where all the money in the world won't make a bigger difference than what you can make now.

It looks to me like the best option is to invest until the market saturates (i.e. you have so much money you're loaning out that you can't get anything beyond a 1% return on investment per year), and then donate. It will do far more than 100 times as much good, canceling out the 1% chance of success. And that's ignoring the amount of good that whole investment saturation will do.