School is different for everyone. Some people coast through without having to open a book, some don't. But either way, everyone will graduate. At least, that's how it is in fiction. In reality some people just don't graduate.
This is probably used for good reason, as it's no fun to watch someone drop out, or not earn the credits they need to graduate. But it can also be a glaring error when someone who made straight Fs or Ds graduates with their class. Sometimes this is Hand Waved as the character doing enough extra credit work to make up for what they missed. But even then, this is hard to believe. Most teachers will only assign extra credit work to those who are already passing. This trope will often go hand-in-hand with Ivy League For Everyone.
In the case of an overly dramatic series, this can be used to create a happy ending. This is exceedingly common in American works.
When it happens in Real Life, this is called Social Promotion., and it is restricted to grade levels earlier than high school.
Fast Times at Ridgemont High: Jeff Spicoli (Sean Penn) is going to fail his History class, which means he wouldn't graduate. However, on the evening of the graduation dance, Mr. Hand shows up at Spicoli's house and informs him that since he has wasted eight hours of class time over the past year, Mr. Hand intends to make up for that time now. They proceed to have a one-on-one tutoring session that lasts until Mr. Hand is satisfied that Spicoli has understood the lesson and finally tells him he will pass him with a D (the lowest possible passing grade).
Beautifully subverted in Monsters University when Mike and Sulley are expelled and work their way up at Monsters Inc. until they reach where they are in the first film.
Oz: Well, it's sort of a funny story. You remember when I didn't graduate?
Willow: Well, I know you had a lot of incompletes, but that's what summer school was for.
Oz: Yeah, well, you remember when I didn't go?
Of course, the out-of-universe purpose served by this was to keep him at Sunnydale High with the other characters even though he was a year older than them.
In Saved by the Bell, Zack is almost never shown studying, and a few times it is shown that he is close to failing out of at least one class, yet he graduates with everyone.
And he was accepted into Yale on his SAT scores, alone
On The George Lopez Show, a running plot point is the question of whether Max, George's dyslexic and generally Book Dumb son, would have to repeat the fifth grade. To the show's credit, it even notes that it might be better for him if he does repeat; however, he squeaks by enough to pass.
On Happy Days, Fonzie spent the first four seasons as a high school dropout. There was even one early episode where he returns only to quickly drop out again. When it came time for Richie, Potsie, and Ralph to graduate, Fonzie started attending night school and graduated alongside them. They did note that it was unusual for a night school student to attend graduation, but the fact that he caught up is still amazing.
Averted on Glee, where Puck's struggling in history class leading to pending graduation became a substantial plot line. However, everyone was shocked when they found out that Brittany didn't graduate and would be spending another year in high school, but she's quick to point out that she maintained a 0.0 grade-point average.
It's revealed in TaleSpin that Baloo never graduated from grade school, and thus may be barred from attending his class reunion.
Averted in Daria. Dumb jock Kevin actually doesn't graduate with the others because his grades were so bad. You'd think he would have been cut from the football team first until his grades improved, but there you go.
Given that he received byes on test because of his football involvement, he might have just outlived his usefulness to the school.
Alternatively, football season doesn't last all year, and "Is It College Yet?" explicitly takes place after it ends; it's possible he stopped getting special treatment once academic suspension from the team stopped being an issue.
Also, given how corrupts Ms Li is, it is entirely possible she failed him, so he would be able to play football for Lawndale High next year (and possibly few more years after that, too).
When Homer Simpson goes to his high school reunion, it's revealed that he failed remedial science and, thus, never graduated. This was actually foreshadowed in an earlier flashback where he avoids Marge before the prom by not going to school for two weeks and missing the relevant classes.