I'm trying to remember the name of a series I read a few years ago. The main plot points that I remember that would distinguish it are the main character is a girl who has to pretend to be a boy to stay enrolled at her school and I think someone in it has lightning magic. I'm pretty sure it's like a "chosen one" trope and the characters are from royal/high status families.
Is it possible that you're thinking of Alanna: The First Adventure by Tamora Pierce?
Alanna of Trebond and her twin brother Thom may be twins, but are very different; Alanna is a tomboy who dreams of being a knight, and Thom wishes to become a sorcerer. Unfortunately, Alanna is shortly to be dispatched by their inattentive father to a temple in the City of the Gods, to learn to become a young lady—to her, a fate worse than death—whilst Thom is similarly destined for the royal palace, where he will train as a knight: his worst nightmare, as he believes that his destiny is to be a sorcerer.
To avoid their respective fates, Alanna and Thom hatch a plan; Alanna will disguise herself as a boy, call herself Alan, and take Thom's place as a knight. Thom will go to the City of the Gods, where he will be able to train as a sorcerer. After convincing their two caregivers, the healing woman Maude and the soldier Coram, that their plan will succeed, they set off.
Alanna is attending to become a knight, not at a magic school, but her brother goes to study magic, she winds up learning some, lightning factors into her magical sword and Sir Roger of Comte (the prince's uncle, who Alanna believes to be up to no good) wields lightning at various parts of the series. And the various pages studying to become knights are pretty much all from the nobility, including the heir, Prince Jonathan.