Biography
Before Ben Franklin flew a kite during a thunderstorm (he was a genius, you know), lightning was an unknown force that was believed to be magical in nature; then he invented the lightning-rod, and the rest was history. However tales continued to center around the mystery of what we now know to be basically nothing more than a large-scale carpet-shock; and thus in much fiction, lightning is still not just a massive electrical discharge which tends to destroy anything it touches (except cars, lightning-rods, steel buildings, towers, most metal objects, and about 8,000 people/year). It is an amazing magical force which can do anything the screenwriter wants — it can turn a computer sentient, shrink whoever it strikes and make the music wonky, turn an already-sentient computer evil, send things through time or into an Alternate Universe, etc. It can miraculously reverse polarities and has been responsible for many a Phlebotinum Breakdown. It can even create life.
Basically, fictional lightning is a Mad Scientist with the ability to fundamentally redesign any machine, especially a futuristic one. If you're in a teleporter when it's struck by lightning, two of you might turn up at the other end; if your stun ray is struck by lightning it may turn into a volatile disintegration gun; if your radio is struck by lightning it could start channeling the dead, and so on, and so forth.
God help you if you perform any kind of experiment during a thunderstorm — all you need is for the building to get struck by lightning and you'll have some kind of malevolent radioactive cloud on your hands — even if your experiment had nothing to do with radioactivity... or, at the very least, you'll gain freakish superhuman powers.
Perhaps the most amazing thing is, not only will lightning never destroy any machine, frequently it will cause a machine to malfunction just once, then return to normal behavior as if nothing happened, a super-condensed form of No Plans, No Prototype, No Backup, as nobody is sure what it did and it can't be made to do it again.
Naturally, these mystical properties extend to lightning in its "harnessed" form: electricity. Look in nineteenth-century Sears and Roebuck catalogs, and you're liable to find ads for actual electrified girdles, which tout the supposed health benefits of close proximity to a constant electrical flow. Symbolically, the notion of lightning as a magical force stems from the ancient belief associating it with the power of the gods; it's a convenient and spectacular visual shorthand for "and then a miracle happens".
There is a grain of truth in all the mythic reverence, since electrical shock can help (relieving depression, regulating heart and muscle rhythm), hinder (causing brain damage, stopping the heart), and often really, really hurt, all by a matter of degree. Further, since electricity and magnetism are directly linked, a character who, for example, can shoot lightning should also be able to wreak havoc with magnetic fields... and since the interaction of most matter is the interplay of electromagnetic fields, someone who can do that can do anything, using Hollywood logic. On the cynical end of this trope, lightning strikes can actually cause personality changes due to nervous system damage.
Electrical shocks to save a life come from a Magical Defibrillator. Not to be confused with the heroine of Final Fantasy XIII, who supposedly can also do anything, or Lightning McQueen, the protagonist of the Pixar film Cars, who can do far, far more than a talking, non-anthropomorphic race car ought to be capable of.
See also Harmless Electrocution, Energy Ball, and Swiss-Army Superpower. For tropes covering the do-anything properties of another scientific topics, see Radiation-Induced Superpowers, Quantum Mechanics Can Do Anything, and Chemistry Can Do Anything.