Logic dictates that the fastest way around a corner is to take the shortest, straightest line possible, apexing at the exact midpoint of the corner. But in reality, that isn't always the case.
The goal on a track isn't just to go fastest through a single corner; it's to get around the entire course as quickly as possible. Depending on what lies after one particular corner, it may be beneficial to sacrifice total corner speed for more stability or grip on exit or entry.
For example, if a corner happens to come before a long straightaway, it would be better to take a late apex (shown above with the green line), turning later and apexing near the end of the curve. This allows you to get the car straightened out sooner, and therefore, accelerate earlier. Since you're on the power earlier, you'll be able to achieve a faster speed down the straight.
Conversely, if a corner comes immediately before another corner (or set of corners), it may be more suitable to take an early apex (shown above with the blue line), turning earlier and clipping the inside line sooner. This allows for a faster entry speed and more stability once you reach the end of the turn, setting you up for the next bend.
YouTuber explains how to choose your line in his latest video below, and even mentions the karting line—a method that disregards the apex for the sake of momentum. It's a bit technical, but definitely worth the watch if you're into racing or driving on track.