Question: I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened.

What I look for

* Humanity can no longer use electricity as we do nowadays.
* It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd take at least 50 years.
* There is no problem if lightnings or other "natural electricity" still happen.

EDIT: There's no problem here if the answer requires technologies not yet developed.

As an example of a possible answer, there's the explanation given in the series Revolution, even though I feel that would still need some development.

**Spoiler alert**

> 
> There, the Blackout happend due to Nanites, a nanobot, the size of a virus, that does two things: Absorb electricity and replicate.
> 
> 
>

Answer: 
In the *Council Wars* series, Eric Flint introduces *Mother*, a super-AI [with ubiquitous sensors](http://www.baen.com/chapters/W200311/0743471644___0.htm) and effectors1 capable of absorbing remotely most sources of energy.

So, low voltages are okay, but as soon as a voltage reaches a given threshold, *zzzzt* it disappears into whatever higher dimension *Mother* reaches out of. The same happens with bombs, extreme heat and even powerful enough spring coils.

This setup would be ideal for your purposes.

---

(1) never called *that*, but the behaviour is indistinguishable from the Culture's effectors.
As has been pointed out in the comments, there are lots of important reasons why we can't prevent *electricity* from working at all. The key, then, is to imagine ways of preventing humans from *harnessing* electricity. Trying to screw with electromagnetism is problematic - again, messes with ecology/biology, and could possibly be easily defeated by shielding.

A better bet is to deprive these humans of the **material inputs** necessary to create electricity. The most guaranteed way of accomplishing this is to put your humans in a setting where all metal only exists in trace amounts. This would make it basically impossible for humans to harness electricity in any meaningful way. "No metal" might be too limiting for you though: perhaps you want to eliminate electricity as a premise for some futurist samurai. In that case, you can probably get away with only eliminating the most conductive common metals: copper, silver, gold, aluminum, zinc. Any generator made with less conductive metal, like nickel or iron, is going to be be very very week. If someone did not know about electricity to begin with, they would have a really hard time discovering it using low conductivity metals. If the humans in your world *already* know that electricity can be harnessed, and that they are otherwise deprived of this ability, they might be able to rig something up using nickel wire, but it will be super limited and inefficient. If this is the case, say so in the comments below so I (or more likely someone else) can work on figuring out just how inefficient. 

Note that whatever narrative device you use to eliminate technologically useful quantities of copper, silver, gold, aluminum, zinc (whether it be removing it from earth, or putting your humans on another planet), you will still need some trace amounts of copper and zinc, which are nutritionally essential to humans.