Your retirement will be funded by your investment accounts, such as your 401k, IRA, and taxable brokerage. This works by periodically selling off your investments and withdrawing those funds to your bank account, which then funds your spending. The amount you withdraw ends up being a small portion of the portfolio, leaving the vast majority of it untouched and able to grow. There are various approaches people can use to organize their withdrawals, each with their own quirks.
The simplest approach is to simply withdraw the same amount at set intervals, such as $5k/month or $60k/year. This however, can be risky, as if the market crashes, you will end up withdrawing high percentages of your portfolio, preventing it from being able to recover.
One way to adjust to a volatile market is to instead withdraw a fixed percentage from your portfolio, like 4% per year. For example, if you have $1 million invested, you would withdraw $40k/year that first year. Let's say the next year, market conditions were bad and your portfolio now sits at $800k; this means you would now withdraw $32k. The market could also go up, so if your portfolio instead sits at $1.2 million, you would now withdraw $48k. This can provide a safer approach in down markets, but would also be riskier when the market performs well due to your withdrawals also increasing.
In all likelihood, your spending will vary, as some months you'll travel, or some years you may have more random expenses like a broken fridge. It will also vary based on market conditions, as if your portfolio is up you, can afford to spend more, while if it is down, you can adjust and cut back. Instead of committing to a specific amount or percentage, you can instead start with a baseline, then adjust based on market conditions and your own interests. For example, let's say you start with $50k/year, but the market is down, so instead you cut back and only end up withdrawing $40k. Then, the next year, the market is looking good and you've really wanted to take a trip to Bora Bora, so now you take our $70k for the year. Maybe the next year, your portfolio grows even more, but you just never made any big plans and no emergencies came up, so you only withdrew $45k. The drawback here is your propensity to save vs spend will largely determine this approach can work.
Perhaps the best approach is to start with a baseline, but set rules and limits for what you can withdraw based on market conditions. As a starting point, maybe you commit to $50k to start, but adjust it up and down between $40-60k of your portfolio based on market conditions. This way, you now have flexible spending, but it never gets too far from the initial goal.
$100k will feel different now vs 20 years down the line, so in order to maintain your quality of life, you would need to increase your withdrawals. This results in about an additional 2-3% per year, so a $100k withdrawal would be $103k the following year. This is only required if following a set amount, as if you're instead working with percentages of your portfolio, your portfolio will likely increase and thus your withdrawals will keep up with inflation.
A general rule of thumb is to start with the amount you want to be able to spend per year, then multiple that by 25. This is also called the 4% rule or a withdrawal rate of 4%. For example, if you want to spend $100k/year, you would need $2.5 million.
The reason you need this much is sequence risk, or sequence of returns risk, which is the risk of retiring right as stocks go down. Basically, if you have a few bad years right when you retire, your portfolio can be irrevocably damaged. You would either have to go back to work, substantially lower spending, or run out of money.
Given a balanced portfolio (75% stocks, 25% bonds), a 4% withdrawal rate has miniscule failure rate, or the chance of running out of money after 30 years. As you increase the withdrawal rate, the failure rate increases substantially:
5% Withdrawal Rate - 18% Failure Rate
6% Withdrawal Rate - 40% Failure Rate
7% Withdrawal Rate - 55% Failure Rate
8% Withdrawal Rate - 65% Failure Rate
This is based on the well-known Trinity Study, in which researchers backtested various portfolios to see how often they survived retirement. Portfolios often ended up failing not because the long-term returns were bad, but simply because the first few years did too much damage. Of course, you can lower your expenses for a couple years to allow your portfolio to recover. Retirement is also not a strict commitment to not working, as many work part-time or intermittently. Many people have argued that a 5% withdrawal rate is fine since you can adjust to the market, while other researchers expected lower future returns and have instead suggested a 3% withdrawal rate.
In the end, it is not the minutiae of 3% vs 5% that matters, but rather just knowing that to fund your retirement, you'll likely need at least 25x your preferred annual spending.