What do you actually do when you are locked out of an account?
Work through the recovery routes in order of reliability — and the critical insight is that account recovery almost always runs through something else you control, which means the real problem is usually that the recovery route itself is broken or out of date.
The sequence:
Rule out the simple causes first: caps lock, an old saved password autofilling, the wrong account on a device with several, an expired session, or a service outage — check the status page before assuming it is you.
Use the account's own recovery flow, which typically sends a code to a recovery email or phone.
Use backup codes, if you saved them when enabling two-factor authentication. This is what they are for, and almost nobody saves them.
Use a second factor you still have — another device, a hardware key, an authenticator app on a spare phone.
Submit an account recovery request, which asks questions only the owner should be able to answer. These are slow, frequently rejected, and deliberately so — a recovery process easy enough to satisfy you is easy enough to satisfy an attacker.
Why two-factor authentication causes so many lockouts:
A lost or replaced phone with authenticator codes that were never backed up, and codes do not migrate automatically with a phone transfer unless the app supports it.
A changed phone number, where SMS codes go to a number you no longer control — and recycled numbers mean someone else may receive them.
Time drift on the device, since time-based codes fail if the clock is wrong. Enabling automatic time is a genuine fix for codes that are "not working".
What actually prevents it, and is worth doing today:
Save backup codes somewhere offline.
Register two factors, not one — a second key or a second device.
Keep recovery email and phone current, and make sure the recovery email is itself recoverable.
Use an authenticator app with encrypted backup, or a password manager that stores codes.
Do not rely on SMS alone, which is the weakest factor and the easiest to lose.