It relates to Spiritualism and modern extensions.
Essentially, spiritualism uses "magic tricks" (illusions) to create the impression of paranormal activity, often as simple as thumping a table or flickering candles.
These techniques have been extended to electrical interference per a recent trend called EVP (electronic voice phenomenon).
As Rodia mentions, the 1982 film Poltergiest is the source of many modern tropes regarding spirits. More than anything this may be understood as a function of the influence of Stephen Spielberg as a myth-maker. (See: Close Encounters of the Third Kind.)
The modern mythologies of both the paranormal and UFOs is a kind of feedback loop between pseudoscience and artists.
Specifically, artists like Spielberg create stories and images based on real-world anecdotal (unverifiable) accounts. When these stories and images become cultural references points, they in turn produce anecdotal accounts that reinforce the stories and images.
It may be helpful to think of these ideas as memes, which jump from human mind to human mind.
The less an individual knows about real science and scientific method, the more likely they are to believe these accounts, or interpret subjective experiences as proof of what cannot be verified.
- Ghosts are involved with electricity because our modern experience involves electricity
In essence, folklore can evolve, and the belief in ghosts is strengthened if their presence can be show to have quantifiable effects, hence the recent relationship with electricity.
Also, never forget the profit motive--television shows featuring ghost hunters are perennially popular, and produce not insignificant revenues. (One can find a variety of EMF for sale on Amazon;)
There are a variety of specific pseudo-scientific, explanations.
This Quora question "Can ghosts affect electric lights?" is demonstrative, in the sense that the question itself asserts that:
Most spirits vibrate at a higher frequency than humans, so in order to communicate, they need to slow down their vibrations. This can take some practice. In addition, spirits are forms comprised of electromagnetic energy. This is also the same type of energy field in our light, TV, and radio waves. As a result, when spirits are around, their energy fields disrupt those fields of light, TV, and radio and can create disturbances. These disturbances may manifest in flickering of lights, sound not working on the TV, and radio stations loosing their frequencies. All of these are little ways to let us know the spirits are around us.
This article "How Ghosts Work: Ghosts and Electrical Fields" provides the context:
In some haunted locations, researchers have claimed to have measured magnetic fields that are stronger than normal or which exhibit unusual fluctuations. These may be localized phenomena that stem from electronic equipment or geological formations, or they may be part of the Earth's magnetic field.
Some paranormal investigators think of this as proof of a supernatural presence -- the ghosts create the field. Others suggest that these fields can interact with the human brain, causing hallucinations, dizziness or other neurological symptoms. Some researchers have theorized that this is one of the reasons people report more ghostly activity at night. Because of the way the solar wind interacts with the Earth's magnetosphere, the planet's magnetic field stretches out on the side that's in darkness. Some researchers hypothesize that this expanded field interacts more strongly with people's brains.
Another blog "Ghosts and Electricity" provides more detail, but also highlights the distinction between science and pseudoscience:
As paranormal investigators, we know that ghosts can manipulate our electronics. We’ve seen it happen over and over again. Cell phone settings get inexplicably changed during an investigation and radios or television sets get turned on and off, just to list a few. But, what if ghosts can actually pull energy from these devices?
One of the most standard pieces of paranormal investigation equipment is the EMF meter. Simply stated, an EMF meter measures the changes of the electromagnetic field in a given area. There are various units, some more precise than others, but I prefer the Mel Meter, manufactured by D.A.S. Distribution Inc., because it is easy to use and also measures the ambient room temperature. If you hold one near a source of electricity, the reading on the meter will often increase. Electrical appliances such as alarm clocks, ceiling fans, and microwave ovens will cause an EMF meter’s readings to spike upwards.
The paranormal investigators "know that ghosts can manipulate our electronics", but, to this day, there's never been proof that passes muster in regard to scientific method. (The counter to this fact is generally a conspiracy by scientists to suppress the truth, which itself comprises a contemporary mythology of it's own.
The upside is that horror movies will continue to stay "fresh" so long as human technology continues to advance.
And for we mythographers, it's quite exciting to be able to witness folklore in formation, because such studies may provide insights into the formation of folklore of the past.
Other modern "mythologies in formation" are the mythology of Artificial Intelligence, the mythology of the multiverse, the mythology UFO's and extra-terrestrials, and modern conspiracy theories, including the conspiracy of the Illuminati.