You photograph it like you would shoot a time-lapse. You need to use an intervalometer (some cameras have them built in) and set it to continuously shoot long exposure photos.I've a question: How do I get a good photo of lightning? I've got a mirrorless camera.
Shoot in manual with a low iso, aperture around F8, and a shutter speed around 10-20 seconds (for shooting at night). Manual focus on an object far away. Set your interval 1 second longer than your shutter speed and start shooting. It will keep shooting photos, then when lightning pops during your ~10 second exposure you will get a picture of it.