This is all done in post-production - these days, it's really quite simple to get the computer to do this: the post-production special effects people will select the source (the person's fingers/hands) and the target, and possibly specify how long the effect should be used, and let the computer do the rest. The computer can probably even keep track of the actor's hands as they move within the camera frame through the sequence - otherwise, the special effects artist will just repeat selections for each frame, and have the computer fill in the effect.
Before computers could do the leg work, the whole effect would have been drawn by hand on a frame by frame basis onto digital stills of the scene.
Before computers were used at all, the effect would have been drawn by hand on a frame by frame basis and either overlaid on the original film and run through a composite camera to create a single film version with the effect or, right in the early days of film, it would have been painted straight onto the original film.