WARNING: This article features major spoilers from the Black Lightning series finale.
Despite having recast Jennifer Pierce, a.k.a. Lightning, the Arrowverse ended reversing it with a big twist in the Black Lightning series finale. Not long after The CW announced that Black Lightning season 4 would the show's last one, China Ann McClain, who plays Jennifer, revealed she was already planning on leaving the series. McClain discussed that she wouldn't be in every episode, which is what led to the surprise of Laura Karuki being recast as Lightning in the middle of the season.
But ever since Black Lightning recast one of the Arrowverse's teenage superheroes, there were some suspicions about "Jennifer's" new look. From the troublesome test results that Lynn did on her to JJ's slip-up of calling Jefferson "daddy" instead of dad, something was clearly up. After a couple of hints that something wasn't right, the Black Lightning series finale clarified what was really going on. In the final installment of the Arrowverse drama, JJ almost gets absorbed by the ionosphere but manages to escape.
But while JJ manages to get away, McClain's Jennifer suddenly begins to reemerge, which is where the Black Lightning series finale unveils its bigger twist. As Jennifer confronts JJ, the original Lightning reveals she had been inside the latter's head this whole time. While they come face-to-face for a showdown, JJ reveals the nature of who, or specifically, what she is, which is where the show unveils its science-fiction twist. Rather than being a girl from another Earth in the Arrowverse Multiverse, JJ is actually a spirit who was part of the ionosphere - or the glaze as it is technically called. When Jennifer first started traveling into the glaze over and over, the spirit grew hatred towards Lightning - jealous that not only did Jennifer have powers and a physical form, but Lightning could also come and go as she pleased.
That is why whenever Jennifer would come back, the spirit made an effort to will themselves closer and closer to her. That is what leads up to the big ending in Black Lightning season 4, episode 4, titled "The Book of Reconstruction: Chapter Four," where Jennifer "blew up", thus paving the way for Karuki's Arrowverse casting. But while the spirit looked different from McClain, they were still able to access Jennifer's memories and DNA, thus why most of Lynn's tests confirmed it was their daughter. While trying to kill Jennifer altogether, JJ is ultimately stopped by Lightning as she takes back her life. Despite it definitely being an unexpected back story, it does make sense that they would find a way to have McClain return to the role.