In many stories, there are precursor artifacts that often have miraculous powers. Often, those artifacts are hundreds, if not thousands of years old. But, looking at our own technology, most of our devices wouldn't last more than a few decades. Even those designed to last, have lifetimes of no more than a hundred years. And often, designing super-durable devices would be quite expensive. Also, many of our devices require existing infrastructure to work, like electricity, internet or satellites.
The question is, why would technologically advanced precursors create devices that can last for millennia and can work without any infrastructure?
Some points to make:
4 contributing factors could be: Lifespan, Economics, Hardware Limitations, and Operational Purpose. I'll step through each in turn
If your Precursor race have a typical lifespan of around 1,000 of our years, then a 2 year working lifespan for a device is, proportionally, like having to replace your phone every 2 and a half months. Of course, making the materials durable enough to last 20 years may mean it's hard to make them flimsy enough to also fail within 30 years...
One of the Driving Forces behind today's replaceable upgrade-focussed society ("Buy it, break it, buy a new/better one") is Economics - the companies that make the devices want to be able to sell you a new one, as soon as possible. This is basic Capitalism, and there are examples throughout history of Why.
For example: Are you familiar with the adage/claim that white goods in the 50s would last for 50 years, but in the 90s they only lasted 10? Well, it's true - in the early days, when no one had a fridge, or a washing machine, or a vacuum cleaner, companies sold them in droves. Then they hit market saturation, where everyone had everything, and no one was buying any more. So, they went back to the drawing board, and make the new devices cheaper, and less resilient - they want everything to have a lifespan of 5-10 years, so that one year you need to buy a new dishwasher, the next a tumble-dryer, then a fridge, washing machine, freezer, etc. More money for them every year.
If your precursors are a post-scarcity society, they may have completely different economics - or, they may be expanding fast enough that the market is growing faster than it can reach saturation. This would mean that there was less incentive to make devices that needed replacing regularly, and more incentive to be the "reliable" brand that everyone buys because you only need to do so once.
Are you familiar with Moore's Law? It (roughly) states "The number of Transistors in an Integrated Circuit doubles approximately every 2 years". This has 2 consequences: Electronic devices of a certain computing power can keep shrinking, and Electronic devices of a certain size can keep getting more computationally powerful.
This is an "observational law" - a pattern that is seen, rather than a way the Universe is set up - and the pattern wavers (sometimes it more-than-doubles, sometimes less) but it about evens out. However, every so often there is worry that the law will "break" - components that get too small are more strongly influenced by laws of physics that are "drowned out" in larger components, the cost of researching new technology gets more expensive as the "easy" discoveries are tapped out, et cetera.
Usually, we discover some new trick or manufacturing method or metamaterial that allows us to keep going, but eventually we won't. Wires need to be at least an atom thick for current to flow, with insulation to prevent short-circuits, and so on. If your Precursors have hit their limit, then their technology will reach a stage where obsolescence is a waste, and is dropped.
Obsolescence is, at a basic level, a Consumer thing. If you look at a the goods and devices you find on the High Street, they are designed to be used, and then replaced. But! What if we look elsewhere?
Scientific and Military equipment is generally designed to be rugged and to last a long time. This is because you don't want it to break when you are in the middle of Research or an Operation - and especially if you are in inhospitable conditions miles from Civilisation such as an Undersea Laboratory, Volcanic Caldera, Artic Tundra, or a Vast Desert. A lot of this equipment (especially on the Scientific side) is designed to operate for a long time, without regular maintenance - so it needs a decent Power Source.
You also get emergency "Survival Gear". Nothing pretty, but enough to keep you alive or to call for help when something goes wrong. Possibly spare parts to jury-rig a damaged ship/shuttle. This might even be stored in an outpost for anyone stranded on the planet - like a high-tech Bothy. This is not a situation where you want the gear to have run out of power in the Hundred years or so since anyone last passed by! The technology would be basic, and simple to use. The Precursors may even have sent out automated "seed ships" to build shelters on barely-habitable planets that they have never actually visited, as a "Safety Net" for Explorers and Travellers, like a "Hyperlane-side Assistance" scheme.
(This last point could be compared to an Abacus-using society discovering a cache of mechanical calculators stored for in case our Computers fail, and undergoing a technological revolution based on that - all without realising quite how far ahead of that we really are)
Edit for the "Planned Obsolescence" naysayers: Apple and Samsung have, just this week, been handed fines of €10m and €5m for writing and deploying "software updates" specifically designed to reduce performance of their older phone models as a form of planned obsolescence. In Apple's case, this included reducing Battery lifespan, hence the higher fine.
They do it in order to be remembered. It is thrilling to think that somebody will discover your message in a distant future. You don’t know this person, and this person doesn’t know you. Yet you managed to send him a message, and perhaps a gift if this person can use the technology you sent. You managed to send a gift through time.
Look at humans, they like to send message to unknown recipients:
And humans are also trying to send message to the future. Time capsule is the best known way to do it. The crypt of Civilization is an interesting example using technology. If you google for it, you will find examples of both time capsule being created recently, or old ones being founds. For instance:
So I think the best explanation for the artefact from precursors is: because they could, and because they also felt thrilled by the idea of a part of themselves travelling through time.
Time is something that probably all sentient species will notice the same as we do. Every sentient being will somehow wonder what the future will be like. Every sentient being will know that at some point it will die, so leaving a message for the future is probably something that is not so strange.
A means to jump start civilization again
Wars which wipe out entire groups happen frequently, even on Earth where the ability to end millions of lives and destroy cities only recently went from days/weeks to a matter of seconds.
If your society knows that (near) extinction is a possibility, it will want to give a boot strap to the future generations to get them advancing faster. Artifacts may have powers/information which help prevent the society from repeating its mistakes. They may also have the means to help defend the society against outside attackers or even to take the offensive again at an earlier stage if both past civilizations fought to (near) mutual destruction.
Making this technology simplistic and robust are necessities for this to happen. Normally, it isn't economically feasible to, even accidentally, make technology which lasts millennium for most purposes. The above would be a reason why the large amount of resources may be spent in pursuing this endeavor.
The most eficient driver for innovation was more often than not lazyness.
Nanotechnology, AI, biotechnology, nuclear fusion, antimatter, all of that is child's play for them.
Look at our current society: intellectual professions like engineering, scientific research and software development are highly valued while laboring professions like sanitation, construction work and maintennance are not. Currently we don't have the technology to replace humans in those less valued areas, but your precursors did.
And because you are too lazy to manually instruct a maintenance robot to start working on a damaged construction robot, you let then work away autonomously for all eternity.
At some point these robots will change to stand-by mode, because their task is fulfilled for the moment. All buildings are constructed and in perfect shape. Since construction is finished, no more resources are needed. Since no resources are harvested, no more maintenance is required. To the unassuming adventurer it seems like all these robots are lying around broken, until one of them accidently damages a robot and the fleet of maintenance drones gets activated...
Maybe some of those artifacts that survived were just prototypes? Those are not necessarily meant to be sturdier, but then again it does not need to be the top-of-the-line specs. If you just want a proof of concept, you build it with what's available around you at the moment - and that could lead to some sturdy casing (since that is was available at the moment). You may need to charge the battery before you could try and use that, though...
Museum exhibition piece
Usually, even if those are the typical gadgets you'll carry around in your pocket, the people that put them on the exhibition want them to work for a long, long time without a hitch. When one goes to any of the museum of technic, there are gadgets in there that have their own power supplies, and are made to last slightly longer than your typical everyday machine. Because that's what the museums are for, right?
Why do ancient buildings still stand? Why do ancient ship wrecks with intact goods get found? Why do fossils exist from millions of years ago?
Mostly statistical anomalies.
Either they were buried in special circumstance - tar pits, volcanic flows, anoxic deep water / whatever.
While almost all our cities and buildings will be dust in a million years there is likely going to be something, somewhere that you would expect to be just another stain of calcium carbonate in the soil which is surprisingly intact.
Maybe it was submerged as a dam filled and survived as it was silted over. Maybe it was buried Pompeii style. Maybe it has been floating in cold inert space for a couple thousand years.
Once you build a few billion of the things something is bound to get though by nothing other than statistical fluke. (The key is usually to get rid of oxygen and weathering effects.)
One assumption which seems odd to me is that the Precursors will uniformly have the same attitude about obsolescence as modern humans - ignoring that modern humans don't have uniform attitudes about obsolescence.
One of the axioms of the question seems to be that Precursor technology is arbitrarily advanced, so what humans find stashed here and there isn't the peak of Precursor technology, it's the product of a few quirky craftspeople.
The aren't in it for the money, so planned obsolescence isn't a feature, it's an insult to the expression of the craft they'd been honing over their near-millennial lifespan. They're in it for the satisfaction of building something that's good and solid and represents their skill.
That's powerful motivation. And coupled with the post-scarcity that arbitrarily advanced technology implies, they could sink enormous amounts of time, energy, and materials into these projects.
Yes it sounds ridiculous... but think about it, (using our current world as an example) until the latest generation of smartphones, the big advert was "crafted out of a single piece of solid aircraft grade aluminium". They want you to believe these products will last. At least until the current grade of phones which very intelligently have glass on the front and back just to make sure it'll break when dropped and a new one will need to be paid for.
But if the Precursors were a very advanced but physically weak race then they might be more inclined to drop something, the more likely it is to be dropped the sturdier it gets built. So this is very possible a way around what you want.
Looking at our modern world again... the more advanced something is, the smaller the components have to be, and therefore the shorter its lifespan. In egyptian times they "wrote" on the walls... or stone tablets and for higher class people, on papyrus scrolls... And built massive structures out of stone, they had metal but it was very very expensive.
Those scrolls haven't survived, but the stone has, the more basic it is the longer it will survive, but again, if it is not valued, like a lot of modern technology, then it will not last.
Then a few hundred years ago we were still occasionally writing on walls, but this time it was with paint instead of a chisel. And of course writing on paper as well. Most of that paper probably hasn't survived unless someone valued it, and kept it dry and safe. And those paintings on walls, again if they were not valued by someone, then got painted over, or the paint began to fade and wasn't repainted.
It MUST be valued by someone to survive
If your Precursors are indeed similar to how modern humans are, and by that I mean Western Society, City Dwelling Humans, then its very very unlikely anything will survive long term.
They have the long view. They are planting trees.
If you wonder how someone could pick up a 500 year old walkie talkie and use it, you are right to wonder. But although awesome, it is not weird that a group could plant trees, understanding that the trees would last and be useful for centuries. A man can plant a tree knowing that he personally will not live long enough to see the tree bear fruit.
They called in the College Forester, who of course had not been near the college itself for some years, and asked him if there were any oaks for possible use.
He pulled his forelock and said, “Well sirs, we was wonderin’ when you’d be askin’.”
Upon further inquiry it was discovered that when the College was founded, a grove of oaks had been planted to replace the beams in the dining hall when they became beetly, because oak beams always become beetly in the end. This plan had been passed down from one Forester to the next for over five hundred years saying “You don’t cut them oaks. Them’s for the College Hall.”
If you want made things that can last 1000 years, have them be alive. Your precursors are masters of tech. Their deathless devices sustain themselves, seeking the minimal resources to repair, maintain and persist over the ages. Of course if they re-enter use they might need more fuel or food or what have you, but it is not science fiction that a biological entity can last for centuries.
Having the devices of the precursors be alive also opens narrative potential. You could have them be like plants. Or like friendly dogs or horses, happy to see someone interested in them after so long. Or depending on the tone of your work, they could be something worse. From The Case of Charles Dexter Ward by H.P. Lovecraft. http://www.hplovecraft.com/writings/texts/fiction/cdw.aspx
Then he whispered, in accents doubly terrible because of the cracked voice he used, “Damn ’em, they do eat, but they don’t need to! That’s the rare part! A month, you say, without food? Lud, Sir, you be modest! D’ye know, that was the joke on poor old Whipple with his virtuous bluster! Kill everything off, would he? Why, damme, he was half-deaf with the noise from Outside and never saw or heard aught from the wells! He never dreamed they were there at all! Devil take ye, those cursed things have been howling down there ever since Curwen was done for a hundred and fifty-seven years gone!”
Maybe after a very long time some of these devices start to change and mutate. A device might still function, but in a manner different from what the precursors intended at its long ago creation.
An ancient technological civilization would probably have gotten more time with modernity than we have, so far.
Consumer goods that are closer to the technological edge of what a society can make tend to be delicate, because the technology to make them is still under development, and the drive is for functionality, not longevity.
You could pay for a super-durable 2010-era-tech 2G cellphone in 2018, but you wouldn't, because it would be too big, cost the same, and not work as well.
Cell phones made in 2018 have batteries, screens, and CPUs that could not have been made by humans in 2010. Those technologies will probably have failures that no one foresaw. The demands made on those components are responding to demands other than longevity. As they age, their failures will inform new designs.
In 200 years, after Moore's law winds down, and battery technology reaches some limits, cell phones will probably last a lot longer.
We're actually making great strides toward longevity-- when was the last time your car broke down?
While other answers have dealt with concerns such as obsolescence, I suggest that they have ignored the effects of being part of a post-scarcity economy. Post-scarcity is the name given to the (presumed) economy which results when semi-autonomous, automated production has essentially reduced the price of most goods to zero.
This could, obviously, result in fads and styles sweeping through the society at a breakneck pace. On the other hand, it could cause the society to step back and take a longer view of things. In the latter case, a fondness for elegance and durability might emerge. Making something which will last forever might be very expensive, but the cost of production amortized over eons will be very low.
Because it's necessary that they do.
We are hitting this issue already, Nuclear Waste repositories are a unique challenge for our civilisation.
Here is thousands and thousands of litres of intensely radioactive material buried in perpetuity.
The half lives involved require tens of thousands of years before it will be safe enough to go near.
It must not be disturbed, ever.
How do we keep people away for 10,000 years?
How do we communicate the danger without inviting adventurous explorers to come die horrible deaths?
We struggle to understand the messages written by people half that many years ago and we have the full weight of our technology and experience behind us. What chance does some lone explorer have? Creating a message that stays usable for longer than any civilisation, culture or religion we've ever known is a staggering prospect.
There are a lot of schools of thought, but most of them revolve around leaving something lasting as a marker, embedding the knowledge into local folklore and culture..
It has to be self-correcting, it has to adapt to communicate with anyone who stumbles across it. It must stand sentinel for millennia or live with a town around it and still get its message across reliably.
The maintenance of the vault, its protection and stewardship, deterrence of visitors who opt to ignore the warnings.
Your precursors may not be working with radioactives, but who knows what they made? What horrors must be kept secluded?
For such a technologically powerful civilisation, your Precursors may well opt for a technological solution to these tasks, and for that, they need to make something lasting.
The precursor had a different biorhythm. They lived longer and slower than we do. Like turtles. As such their "lifetime-warranty" was usually geared to ~1000 Years and their technology development thus put greater emphasis on longevity.
Add to that, they did some sub-FTL space-travel in the later stages of their civilization where they would be in cryo-sleep. When they returned after years of travel they would want their stuff to work as they left it.
Remark on the Side: Our mentality relating to obsolescence has only recently changed, with the industrial revolution and the need for growth in our capitalistic economy. In most of Human history people would generally prefer things that would last as long as possible.
Consider which of the devices we might create now might be considered magical to historical humans, and push the historical humans far enough back in time that the technology gap between us and them corresponds to the tech gap you want between the story humans and the Precursors.
If the technology gap is large enough, then virtually anything we might produce nowadays might be a magical artefact to our former selves, and plenty of the items we produce now have, deliberately or accidentally, extremely long lifespans. To an Age of Sail mariner used to replacing parts of their ship on a near-constant basis, every part of a modern fiberglass boat with stainless steel rigging would be magically corrosion-resistant. To a Roman engineer any modern buildings built with concrete rebar are magically superior structures to anything they could have achieved; to a cave man the very idea of concrete or even worked and quarried stone is magical. And to an ancient Egyptian potter, a plastic coffee cup is very definitely a magical drinking vessel.
The real question is actually not "why are there magical artefacts left over from the precursors", but "why aren't there loads of magical artefacts", being basically the 'detritus' of the precursor species. You could invoke lots of different in-universe reasons for this, from the Precursors making a concerted but not-entirely-complete effort to clean up the rubbish of their whole civilisation before vanishing, to a small group of Precursors (and their technology) becoming separated from the main civilisation in order to abandon a modest amount of technology.
The simple answer? They wouldn't. Or at least their average devices wouldn't. Our most cutting edge technology with smartphones today barely lasts two years because it makes money when people have to re-buy new technology every two years.
The same thing will likely happen in the future. Even if they could create an amazing device that would last 1,000's of years and be self-sufficient, they'd be putting themselves out of business by doing it! And if any one company started making advances in the tech and selling it, well it'd be in everyone else's best interest to shut them down quick, wouldn't it. It'd be like when oil companies actively bought out and recalled electric cars to keep themselves at the top of the foodchain.
So where do these crazy durable devices come from? They're homegrown. No company would mass-produce them since they'd put themselves out of business and if anyone tried to mass-produce, the other companies would find a way to shut them down. So these devices are created by hobbyists or people worried that the world is going to end. They have a whole underground group with monthly meetings to work on their durable projects so that when the end comes and they have no more infrastructure, they'll be ready with weapons and tools that won't rely on anything except their users.
This would also explain why these devices are so rare and each is so unique, if that's what your plot calls for.
For example, consider medical syringes. In the West, syringes were made of plastic, used once, and disposed. Syringes in the Soviet Union were made of glass. After each use, they were washed, re-sterilized, and reused.
There are many other examples of the Soviets using durable technology, when the West was using disposable technology or planned obsolescence.
So what you need is a centralized economy, where certain applications (e.g. military) are given higher priority than other applications (e.g. consumer electronics). Some low-priority applications will still be considered essential (e.g. medical equipment), so there will be a drive to make that technology as durable as possible. Compared to something designed to become obsolete, durable technologies use less design time, manufacturing time, and materials, which can be shifted to higher priorities. The durable products still need maintenance, but if semi-skilled labor is cheap (especially compared to the cost of manufacturing), that's not a problem.