From Sonic Retro
The Lightning Shield, otherwise known as the Magnetic Shield or Thunder Shield, and known as the Thunder Barrier (サンダーバリア) in Japan, is a power-up first introduced in Sonic the Hedgehog 3 and a variant of the standard Shield. In addition to serving as a one-shot barrier against damage and life loss, the Lightning Shield attracts Rings towards the player if they get close enough. It is often considered a particularly useful power-up because of this feature.
While all variants of the Shield drag Rings in, minor details differ from game to game. A functionally similar Shield, the Magnetic Shield, appears in Sonic Adventure and later titles, though lacks the Lightning Shield's other traits. Other variants of the basic Shield include the Fire Shield, Water Shield, and Gold Shield.
Sonic the Hedgehog 3 and Sonic & Knuckles
The Shield makes its first appearance as the Lightning Shield in Sonic the Hedgehog 3 and later Sonic & Knuckles. In both games, the Shield would be lost if the player took it underwater; and when playing as Sonic, holding a Lightning Shield exchanged the Insta-Shield move with a sparking Double Jump, enabling the hedgehog to leap much higher and potentially access otherwise difficult platforms.
Additionally, the Lightning Shield makes all characters invulnerable to both electric damage (like the crackling sub-conveyor-belt floors in Death Egg Zone and the Graviton Mobile's electromagnetism in Carnival Night Zone), and, like all other Shields in the games, deflects projectiles from Badniks.
Sonic R features the Shield as a random item acquired from Item Panels and is referred to as the Lightning Shield in Western versions, and simply as Thunder (サンダー) in Japanese versions. In this game, it takes the appearance of a yellow bubble and draws in Rings as usual, however it will wash away when its user enters water.
The Lightning Shield returns in classic monitor form in a few Challenge Acts in Sonic Generations, now called the Thunder Shield, and like the original Shield can protect against electrical damage and allows Classic Sonic to Double Jump. When the "Thunder Shield Challenge" has been completed, the Thunder Shield can be bought in the Skill Shop and, if equipped, can be activated at any time for Classic Sonic by pressing /.
The Nintendo 3DS version instead uses the Magnetic Shield.
Sonic the Hedgehog and Sonic the Hedgehog 2 (2013 editions)
The Lightning Shield appears in iOS/Android remake of the original game and its sequel if the player sets "Items" to "S1+S3" or "S2+S3" in the Level Select menu (or place a Lightning Shield monitor in debug mode). It behaves exactly as it does in Sonic 3 & Knuckles, including the double-jump and disappearing when it touches water. In the Sonic 2 remake, the Lightning Shield also appears as a random item in VS. Mode.
Sonic Lost World
The Lightning Shield appears again in Sonic Lost World as a power-up the player can receive from Miiverse in the Wii U version, or found within levels in the Nintendo 3DS version. It does not come with the ability to perform a Double Jump (as Sonic can naturally perform one), but it still attracts Rings.
The Lightning Shield appears once again in Sonic Mania, functioning exactly as it did in Sonic 3 & Knuckles, except now with the ability to stick to electromagnets in Flying Battery Zone or can be used in Titanic Monarch Zone with some pairs of poles that produce electricity and magnetize the player if they have a Lightning Shield.
Similar items and abilities
Curiously, while the Lightning Shield doesn't appear in Sonic 3D: Flickies' Island, the regular blue Shield offers protection against electrical hazards in Gene Gadget Zone.
The Yellow Gem in Sonic the Hedgehog (2006) gives Sonic an ability very similar to the Lightning Shield, but it is a move and isn't permanently active. In Sonic Unleashed and Sonic Colours, while the Shield does not appear, the Boost move attracts Rings towards Sonic as he runs past them.
Sonic being attracted to an electromagnet in Sonic Mania's Flying Battery Zone.