I have some SD cards that I use. Is there a limit to how many times I can write over them? If I leave information on a card, is there anything that can cause it to lose this information eventually (other than a magnetic field)? What's the preferred storage conditions for these cards?
Flash memory indeed has limited write cycles. However, by now it is unlikely that you'll encounter this within the normal lifetime of such a card. Usually this is in the order of 100,000 write cycles today and SD cards include circuitry to manage wear-leveling, that is, spread out writes over the storage media evenly to avoid "hot spots"—pages that are written too frequently and therefore failing early.
Information stored on the card is safe even in magnetic fields because the information is not stored magnetically (contrary to hard drives or floppy disks).
As for storage conditions ... you shouldn't store them in mud, water, lava or other harmful conditions. You probably also shouldn't put them on railways and let trains drive over them. Apart from that, not paying particular attention where I store my cards I haven't had any adverse effects so far. In practice I'd think whatever doesn't physically damage the card won't harm the data on it.
In my experience, memory cards are quite durable, though occasionally finicky when it comes to formats. I recently ran a cellphone through the washing machine (it was so dirty), and the 2 GB microSD card works just fine in my new phone (I eventually got the washed phone working too, but it was a good excuse to upgrade).
Write cycles are important, but MTBF (mean time between failures) is often 1M-2M hours or more, factoring in advances such as wear leveling, bad-block marking and management, etc.
The 2004 BBC article Digital memories survive extremes covers an interesting study by Digital Camera Shopper on the durability of memory cards.
In 2004, there was an incident (covered happily in a SanDisk press release at the time) where a photographer's compact flash card survived a bridge explosion where the camera gear was set up so close to the blast that it was destroyed, but the CompactFlash card survived. Other incidents like plane crashes are hyped by SanDisk so much that, admittedly, I get nervous using other brands. That said, it's not always easy to get data from a damaged card. An atmospheric research balloon crashed in the Pacific Ocean and was recovered. One SD card was read easily but another required intervention from SanDisk, but it was eventually read.
Bill Biggart's photos from 9/11 survived the collapse of the second tower on a CompactFlash microdrive card.
If you suspect a card may be getting flakey, or if you run into trouble reading a card, immediately create a backup of everything on the card. There are low-level recovery tools like TestDisk and PhotoRec that come in handy for this.
Never trust FLASH memory of any kind for long term storage. My experience with FLASH is integrity begins to falter in as little as 5 years. The voltages stored in the FLASH memory cells dissipate and can be misinterpreted after a while. High temperatures will accelerate the dissipation and shorten storage even less than 5 years.
High density FLASH where one cell can represent 2 bits has greatest failure rate.. most common in use as it is the cheapest to manufacture (double capacity). Many FLASH micro-controller applications are failing after 5-10 years because of FLASH memory corruption. Re-FLASHing the firmware restores the chip for another 5-10 years etc. So you must refresh FLASH memory data periodically to ensure continued integrity. Same would apply if you wanted to use the SD card as long term storage.
The FLASH memory chip itself is extremely rugged and can offer hundreds, if not thousands of years of service; as long as maximum write cycle lifespan has not been exceeded. FLASH memory cells are like millions of individual microscopic batteries that are charged at different levels. As you know, any battery new in the pack sitting on a shelf for years will eventually discharge. Same applies to FLASH memory cells, they require "recharging" periodically to maintain proper charges which represent data bits. So a FLASH memory card put into a safety deposit box for 25 years... guaranteed you will have corrupt data when you try to use it. I have seen FLASH memory with 20% corruption after 10 years of sitting in storage.
FLASH thumb drives are great for transferring data from one computer to another etc, but NEVER to be used for long term archival storage. Same goes for the conventional CD ROM. After 5-10 years, the contrast dye will fail causing read errors.
The best medium for long term storage are ARCHIVAL GOLD CD-R or similar brand. The storage medium on the disk is a thin layer of 24K gold so it will not oxidize. Data retention on this type of CD is expected to be intact even after 300 years. They are expensive compared to conventional CD-R.
Don't store them below -40 °C or above +100 °C (for example, a car dashboard in some places).
You can theoretically damage them with a severe enough impact. 2000 g or more might be enough.
Don't short the pins, or use them in space. Don't use them for long term archival purposes - in 500 years several of the compounds will have started degrading and no-one will know how to read them any more.
Aside from that, I think it will take substantial physical damage to lose data in storage.
I don't know if this will help, but...
We use µSD cards for the entire filesystem on an embedded device, so they see reads and writes for logging purposes as well as swap. It is a journalled filesystem (previous teams' decision) and I have seen a handful of failures in a population of say 200 devices, with some brands having more failures than others. Some are complete catastrophic failures, I can't read nor re-partition and re-format the card and some are simply filesystem corruption and a re-partition and re-write has them working again. We don't trust those to be sent into the field however.
They have only been in the field for a maximum of 3 years. Thank goodness the real information has already been sent to a database and stored.