Many people go to the gym with no plan, no idea how to workout, and just go in to lift until they fail. This is the normal bro thing to do and may work very well in the beginning. However, once the newbie gains end, it forces them to get more strategic about how to continue their gains. This is when rep ranges become more important and the goal is no longer just to fail every single set.
The rep ranges vary from goal to goal and these are the optimal rep ranges according to Dr. Mike Israetel at RP Strength:
This rep range is generally going to be between 7-15 reps and with a weight where these reps can be achieved leaving 2-3 reps in the tank. 7-15 is optimal for building muscle and getting that overall aesthetic look.
The rep range for general strength is 4-6 reps. Heavy enough to struggle, but not heavy enough to force you to fail. It allows you to continue to get stronger but is not optimal for max strength. It can also offer a good break from hypertrophy training and allow the muscle to resensitize.
This is the lowest rep range where reps are between 1-3. It is a much greater load as it is used to prepare the lifter for max rep attempts. The rep range is often utilized by powerlifters or anyone that has to be near their one rep max.