Lightning was responsible for several instances in which the DeLorean time machine traveled.
It was first the inspiration of Marty McFly after reading the front of the flyer he was given by the Hill Valley Preservation Society, announcing that the Courthouse would be struck by lightning at 10:04 pm that next Saturday night. Doc Brown of 1955, knowing that it would be enough power to trigger time travel, devised a plan to channel a bolt of lightning directly into the flux capacitor, sending Marty back to 1985. They succeeded when the clock tower was hit at precisely the exact time given and 1.21 jigowatts of electricity was funneled into the time machine.
Lightning later came into play while the DeLorean was malfunctioning. While back in 1955 to destroy Grays Sports Almanac, the time circuits developed a fault, causing the Destination Time to switch from November 12, 1955 to January 1, 1885. The car was hit by lightning in mid-air, causing the vehicle to spin on its axis, accelerating it to 88 miles per hour and activating the flux capacitor — sending Doc back to that date. This time, the lightning bolt created a short circuit, destroying the flying circuits and damaging the time circuits. Because replacement parts for the time circuits would not be available until 1947, Doc hid the Delorean in the Delgado Mine — with repair instructions inside so his 1955 self could repair the time machine using components from that era to enable Marty to return to 1985 — and used several generations of Western Union to send a letter to Marty, assuring him that he was alive and well, and living happily in 1885.