Lithium ion batteries are very particular about their operating conditions, and there are a lot of many things that can contribute to better quality of life. Li-ion batteries have a reasonably finite lifespan and can hold only a fraction of their original capacity after a few years, but things like operating temperature, how long the battery spends plugged in, how the battery is used, and the charge cycling you asked about can contribute to how long the battery lasts.
One of the worst things you can do to a Li-ion battery is to run it out completely. Full discharges put a lot of strain on the battery, and it's much better practice to do shallow discharges to no lower than 20 percent. In a way, this is like people running for exercise— running a few miles a day is fine, but running a marathon every day is generally not sustainable. If your Li-ion powered device is running out of juice on a daily basis, you're decreasing its overall useful lifespan, and should probably work some charging stations into your day or change your devices' settings so that it's not churning through its battery so quickly.
There used to be certain types of batteries whose "memory" of their total charge capacity seemed to get confused by shallow discharges. This is not, and never was, the case with Li-ion batteries. However, if you are using something like a notebook computer that gives you time estimates of how much longer the battery will last, this clock can be confused by shallow charging intervals. Most manufacturers recommend that you do a full discharge of the battery about once a month to help your device calibrate the time gauge.
One common misconception is that Li-ion batteries will only count charge cycles if the battery is drained completely in one session; another is that the battery counts one charge cycle for every instance the device is unplugged and plugged in again. Neither of these is true—Li-ion batteries actually count charge cycles based on a 100 percent discharge even when it's summed over multiple sessions. For example, if you discharge a battery to 50 percent one day, charge it back to 100 percent, then discharge it 50 percent again the next day, that is counted as one "cycle" of the battery. So shallow discharges, in all these regards, are ideal for a Li-ion battery.
On the other end of the spectrum, keeping a Li-ion battery fully charged is not good for it either. This isn't because Li-ion batteries can get "overcharged" (something that people used to worry about in The Olden Days of portable computers), but a Li-ion battery that doesn't get used will suffer from capacity loss, meaning that it won't be able to hold as much charge and power your gadgets for as long. Extremely shallow discharges of only a couple percent are also not enough to keep a Li-ion battery in practice, so if you're going to pull the plug, let the battery run down for a little bit.
Another thing that Li-ion batteries hate is heat. This is somewhat less of a problem for cell phones, but a larger problem for notebooks. Using a battery at room temperature for a year can bring its capacity down by as much as 20 percent, and the interior of most computers is much warmer that that. Therefore, laptop batteries usually spend the most time in the worst possible state: plugged in all of the time, running at high temperatures.
There's usually not too much you can do about the temperature issue. If you're going to be using a notebook plugged in at a desk for an extended amount of time, possibly running some intensive programs, you can remove the battery to spare it the heat wave. Turning off your computer when you're not using it is a tiny bit helpful. But for any gadget with a Li-ion battery, keep it out of attics, direct sunlight, the tundra, or anywhere there will be extreme temperatures. To the smartphones I've let sit on picnic tables in the sun and the mp3 players I've left in cars all day long: I'm sorry.
Running the battery out very quickly by drawing a lot of power at once is another way to cause it a lot of strain. For example, running a graphics-intensive game on a smartphone or a notebook for a couple of hours while unplugged is worse for the battery than depleting it over several hours while e-mailing or Internet-browsing (heat is a factor here, too). Again with the running analogy: it's probably harder on you to sprint a mile than to jog it.
If you have a spare battery you don't use that often, manufacturers say the best way to store it is at 40 or 50 percent charge in a cool place, like a refrigerator (but not too cold, as extreme temperatures cause capacity loss, so don't put it in the freezer just because there's extra room next to the peas).
These usage points are not going to drastically affect the lifespan of your battery; that is, you can't make it last forever if your carefully cycle the battery down to 50 percent the second it's full and never use it for anything more intensive than the occasional flash game. Most manufacturers will give you an "up to" figure (up to 80 percent of its original capacity after 1,000 cycles, for example), and careful use will help you reach that, but you won't get too far beyond it. However, following these guidelines (Use your battery. Not too much. Mostly for small apps.) will help your reach the upper echelons of manufacturer estimates.