One of my dad’s jobs at GM was working in service parts distribution, which means the warehouses that ship repair parts to dealers. The old GM guideline was to guarantee parts availability for ten years after the model went out of production but he retired 20 years ago. Cars stay on the roads much longer than they used to. I suspect the guideline number for most automakers now is probably closer to 20 years of parts availability. In reality, it varies greatly as people are saying above based on how popular the model was, whether the automaker sold its tooling to aftermarket manufacturers, whether OEM suppliers continued to produce them independently, whether aftermarket manufacturers put the parts back into production on their own. For desirable models, automakers will occasionally put small volumes of parts back into production at very high prices, but that’s not really relevant to your situation.
I’m not sure if anyone mentioned this problem but one issue is that some cars have an unanticipated fatal flaw. Automakers plan based on past experience to have to replace, let’s say 1% of tail lights on a model each year. But then they discover, like with the Cadillac XLR, that the LED clusters they used had much higher failure rates than anticipated so the service parts operation is very quickly cleared out of any stock. The automaker generally won’t put the parts back into production and they quickly become “NLA” for no longer available. Then, you rely on junkyards and third-party rebuilders to fulfill demand at very high prices. I just faced this issue with the rear subframe on my nephew’s Nissan Altima. The failure rate was high due to shitty bushings that couldn’t be serviced and lots of corrosion that led to recalls. Now, 13 years after that car was built, good rear subframes are almost impossible to find.