In this question, I learned that lightsabers are powered by
a high-output Diatium power cell
Has there been an instance where a lightsaber's "battery" has run out? (Leaving a Jedi in a precarious situation, perhaps?)
The two troops fire laser bolts at OBI-WAN. QUI-GON deflects the bolts back, and the STAPS blow up. One-two. OBI-WAN is exhausted and tries to catch his breath.
OBI-WAN : Sorry, Master, the water fried my weapon.
OBI-WAN pulls out his burnt laser sword handle. QUI-GON inspects it, as JAR JAR pulls himself out of the mud.
QUI-GON : You forgot to turn your power off again, didn't you?
OBI-WAN nods sheeplishly.
QUI-GON : (cont'd) It won't take long to recharge, but this is a lesson I hope you've learned, my young Padawan.
OBI-WAN : Yes, Master.
The novel I, Jedi touches on lightsabers, their construction, and their power. They have power cells that discharge very slowly (like a laptop that's turned off) and this power drain isn't significantly affected by simply being active - they are incredibly efficient.
The power is drained faster when something hits the blade, be it a solid object, a blaster bolt, or another lightsaber.
In The Krytos Trap, a novel from the X-Wing series, Corran Horn (pre-I, Jedi days) discovers a wing of a Jedi museum on Coruscant and finds several lightsabers in it. One of them, which he 'borrows' briefly, still works and helps him immensely in the culmination of the book's plot. Later, Luke talks with Corran about the museum and the lightsabers, and comments that the lightsaber Corran found was one of three in the entire exhibit that functioned without recharging.
This demonstrates that lightsabers DO have power cells that can run dry, even when deactivated, AND that this can take decades - the lightsaber in question hadn't been recharged since before the Clone Wars, and the novel was set post-ROTJ.
In the Legends novel Shatterpoint, Mace Windu's lightsaber runs dry in the middle of combat following his capture and interrogation by local security troops. He assumes at the time that this is due to sabotage, but it's eventually shown that
it was unintentional; its power was simply drained by having been extensively tested cutting and deflecting various substances over the course of a number of hours. (It's not clear exactly how long, since he was unconscious for most of it, but it probably wasn't more than a day.)