$500k is an outlier but I stand by my wheelbarrows full of cash comment generally. Tech pays well, compared to a lot of careers certainly.
If you're in the US there is a pretty clear path to get into FAANG. It's just painful.
Google and others produce entire youtube channels full of instructions on how to study for and pass their interviews.
If you spend 3 hours a night reading books that get recommended on HN (stuff like designing data intensive applications), Practicing on Leetcode, and watching interview prep videos many people will eventually be able to get to a point where they can get a job at a SV tech company. Once you have one of the big companies on your resume it's pretty easy to move around between them to find one that you like and really dig in. Starting comp is not going to be $500k but it's going to be pretty stout, these numbers are transparent on levels.fyi.
From here you just keep up the 3 hours a night of studying. Work a little over time here or there maybe, thats honestly not even that necessary. You don't have to be a jerk or play any weird power games. Just work hard and make good stuff. Plenty of people work really hard to get to FAANG and then do a deep exhale and go "that shit was exhausting!!! I think I'll rest". Nothing wrong with that either, but if you keep working at the same pace you'll get promoted.
There are some other things too along the way to Staff. People skills. Understanding organizations and their many dysfunctions. Learning to drive big projects. These are learnable skills and you get to learn from some of the most talented people on earth.
This may sound like a lot but consider something like...going to night school to get a bachelors degree or something. I suspect that would actually be more than 3 hours a night of work. And much more boring work on top of it.
Do that for 7-10 years. Now you're a Staff Engineer making $500k. If you want you can keep doing it after that and things get even more crazy.
Most people stop along the way and say "this giant pile of money is actually quite enough thank you" or slow down and take promotions as they come rather than studying like a maniac. Or they decide to wander off and try something other than FAANG.
Most of these steps come down to persistence and managing your own psychology. Studying when you don't want to, applying to a company in the bay area again after being rejected 40 or 50 times, Working on the same Leetcode problem for the 4th night in a row.
I don't even especially recommend any of this by the way. It's just one way. But it is a way.