There's lots of stuff that goes out of production for various reasons but #1 is the survival rate. Good example: rear wheel bearings for my Jensen. The rear axle is a Vauxhall Viva (British GM) that was used in hundreds of thousands of cars (over half a million) in both Europe and Australia over probably a 25 year production run (if you include offshoots). But the bearing is no longer produced. It's just not cost effective for a bearing manufacturer to tool up for a production run that is for such a small number of pieces, relatively speaking.
Yamaha built between 250,000 and 500,000 XS650's (depending on who you ask) if you figure a 10% survival rate that's (taking the high figure) 50,000 remaining, if 20% of those are being restored/ridden that's 10,000 worldwide. That's a lot, BUT: when you figure what it costs to make parts which will sit on the shelf for a long time it's not squat.
That's why so many early Mustang restoration parts are made in Taiwan and China, the 'big guys' just don't have the time to fool with what is, to them, tiny production/profit numbers. Sure, there's money in resto parts; Dynacorn is making new 'bodies in white' for Mustangs and Camaros here in the States but 1) have you priced them and 2) they don't have to support a 10 acre plant with 5,000 employees.