The objective is getting to the end of the level. Rings are typically waypoints and indicators of different paths, as well as the primary method of unlocking bonus stages. Levels have many different branching paths to take to get to the end of levels. You can, but shouldn't necessarily play a Sonic game like you would play a Mario game. Mario is more of a straight platformer, Sonic is a combination of platformer and a sort of physics-based free running game. Sonic is to Mario like how SSX is to Coolboarders (or 1080 Snowboarding), they're both snowboarding games, but the objective is different.
If you're a completionist (like if you play the Mario games to get all of the stars or special coins, etc), you should aim to finish every level and get the chaos emeralds that are locked in each level. I don't know if Sonic Mania has this, but Sonic 1, 2, and 3/K do.
Essentially, the chaos emeralds in each sonic are special emeralds that are typically locked away in secret bonus stages that are hidden in each level. The way you get to these zones differs in each sonic. In Sonic 1, they're these rotating mazes, you get to them by collecting at least 50 rings and then at the end of the level there will be a large gold ring that you can jump into which takes you to the bonus stage. In Sonic 2, you get to the bonus stages by having 50 rings and crossing a checkpoint and then jumping into the star portal that the checkpoint creates -- these are the 3D race stages in Sonic 2. In Sonic 3 I kind of forget, but I think that there are enormous rings that you discover and jump into, and it gives you the 3D sphere maze.
Collecting all of the emeralds unlocks a version of super sonic and gives you the proper ending, as Dr. Robotnik/Eggman does not have any emeralds left.
Good sonic games have a good diversity of levels. You have your racing levels that it's tough to fail in and encourage you to find branching paths, like Green Hill or Emerald Hill Zone, then your platforming levels like Labrynth Zone in Sonic 1, then your pinball levels like Casino Night Zone in Sonic 2, a mental Maze level like the one set in the pyramid in Sonic 3. As the game goes on, each level tends to include areas and components of these themes. Think of these sort of like the pacing of any game... Race segments are more relaxed, it's difficult to fail, they're like ring rushes and they typically break up challenging spots of platforming or enemies.