The equation is the same one used for mortgage amortization.
You first want to calculate the PV (present value) for a stream of $50K payments over 20 years at a10% rate.
Then that value is the FV (future value) that you want to save for, and you are looking to solve the payment stream needed to create that future value.
Good luck achieving the 10% return, and in knowing your mortality down to the exact year. Unless this is a homework assignment, which need not reflect real life.
Edit - as indicated above, the first step is to get that value in 20 years:
The image is the user-friendly entry screen for the PV calculation. It walks you though the need to enter rate as per period, therefore I enter .1/12 as the rate. The payment you desire is $50K/yr, and since it's a payment, it's a negative number. The equation in excel that results is:
and the sum calculated is $431,769
Next you wish to know the payments to make to arrive at this number:
In this case, you start at zero PV with a known FV calculated above, and known rate. This solves for the payment needed to get this number, $568.59
The excel equation is:
Most people have access to excel or a public domain spreadsheet application (e.g. Openoffice). If you are often needing to perform such calculations, a business finance calculator is recommended. TI used to make a model BA-35 finance calculator, no longer in production, still on eBay, used.
One more update- these equations whether in excel or a calculator are geared toward per period interest, i.e. when you state 10%, they assume a monthly 10/12%. With that said, you required a 20 year deposit period and 20 year withdrawal period. We know you wish to take out $4166.67 per month. The equation to calculate deposit required becomes - 4166.67/(1.00833333)^240= 568.59
Exact same answer, far less work. To be clear, this works only because you required 240 deposits to produce 240 withdrawals in the future.