It varies *smile*. If you're talking about the component level, component failures are random, but a lot of components never fail. On the other hand some do. It's helpful if the component that fails is a separate piece, like a memory DIMM, or a disk drive, or a fan, etc. Something that can easily be diagnosed and repaired. I've never had to retire a computer because of a component failure, though.
I've had several desktops systems, and none of them stopped working at the point that I stopped using them (see above). I had just upgraded them as far as it made sense, and wanting to run software written for newer hardware made it just too painful to use them any more. For example, you can only put as much memory in a computer as the memory DIMM slots allow. I'm thinking of retiring one that I have now that's about 5.5 years old simply because I'd really like to use USB3.0 for backups and can't find a USB3.0 adapter card that isn't PCI Express, and wouldn't you know it, the computer only takes PCI cards (no PCI Express slots). The computer itself is only expandable to 2GB of memory, and that's maxed out. It still works okay, but I'd sure like that USB3.0 *smile*.
That's just an example of what a difficult question lifetime is to answer. It also depends on what kind of a buyer you are. I tend to not buy bottom of the line, they become unsatisfying too quickly *smile*. On the other hand, I don't get the top of the line, either, that doesn't make any sense to me. I find a "sweet spot" where I think that there's enough oomph there, and the price is reasonable. Like last time I got a quad-processor Q9450 (1.33 GHz. FSB) and 3 GB. of memory, with Vista Home Premium, cost about $1000. That was about 1.5 years ago, and it ran Vista like the wind. Now, I've installed 64-bit Windows 7 and 6GB of memory, and it runs Windows 7 like the wind. I expect to be using the computer at least another 3 years or more, and then will find my next sweet spot and get another system. Or maybe my next computer will be a smart phone *smile*. 3 years is a long way downstream this days. The desktop that I had before that one was comparable, and I still am using it and it's fine (doesn't have USB3.0 though, see above).
To bring this to a close, I think that the 5 year lifetime is possible if you choose wisely, but after 2 or 3 years you'll be doing upgrades, and not too long after that it will become your second computer since the software that's available will expect you to be upping the ante on the computing end. So if you want to run newer software, you'll be doing it with your new desktop, and the old desktop will continue to do what it does best, run the software that it was designed to run, the older stuff.
Since all of the above is pretty subjective, you'll have to see how it works out for you. One thing, though, is that desktop computers do tend to have a longer life and be more upgradable than laptop computers due to heat and add-on card capacity issues.
-Roger