The advice below is only about where to donate it, but that's only one of the key questions.
It's also worth thinking hard about how much you want to give, and how to time your giving.
Even if you decide you want to use the entire amount for good, Phil Trammel's model about giving now vs. giving later suggests that you should donate x% of the capital per year, where x% is mainly given by your discount rate. In general people think the community as a whole should donate 1-10% per year, so I'd suggest, as a starting point, you could pick a percentage in that range to donate each year.
(There are lots of complications. A few examples: (i) If you think the community is too tilted towards investment, and you've found an unusually good opportunity to donate now, then it could be justified to donate the entire amount right fairly soon. But I think a good prior is to donate something close to the optimal percentage for the community as a whole. (ii) If you think AI is coming soon, or lots of big donors are going to enter EA in the coming years, you could argue for a lot of urgency (iii) likewise if you anticipate you might give up on donating in the future (iv) Otoh, you might radically change your views of which causes are best in the coming years. If you donate everything now, you can't take advantage of that learning. (iv) there are also questions about psychology and practicalities e.g. whether you'll still be willing to donate in the future, how much time you have for research, taxes.)
There's also the question of how much to give to charity vs. spend on yourself. As one consideration: once you've donated the money, that's irreversible - if you run into financial hardship later, you could really regret it. Disbursing more slowly is not only probably optimal for impact, but it also preserves this option value.
I think a procedure that makes a lot of sense is to work out how much you'd like to live on per year, and how that might change over time. Then you can donate a significant fraction of any income you earn above that.
For instance, if you'd like to live on $50k, need to save $20k per year for retirement, you get $70k of income from work, and you earn $20k of income from your investments, then your 'excess' that year is $20k, so maybe you put that $20k into your 'altruism' fund, and then donate 1-10% per year of that. (While bearing in mind your altruism fund could be used as emergency funds.) I think this is a pretty good procedure from a tax pov too.
As a rough rule of thumb, I think you can plan to withdraw ~2% per year from money invested in the global index indefinitely, if you want your spending to keep pace with nominal GDP. The 2% is chosen to be roughly the dividend yield on global stocks, accounting for net buybacks, so this percentage will go up and down over time. But right now this means your $1m can provide an indefinite income of ~$20k (pre-tax).
The above was all framed in terms of income, but it probably makes sense to have some wealth goals as well e.g. maybe you should put aside enough for retirement + runway + some income insurance, and then donate excess income after those goals are made.
Related, it's worth thinking about whether you can use the money to empower yourself to do something high-impact. E.g. you now have the freedom to take 1-2 years off work – should you consider retraining, studying, or trying to make a big career change? You might be able to think of ways to increase your long-term impact a lot, perhaps with higher-rates of return than investing the money in the stockmarket.