Real-world drivers never have a magic race line to guide them. They have to figure it out for themselves as they drive around it. As was mentioned, you can more or less see where to go based on the rubber and oil left on the track surface, but real-world drivers still figure it out for themselves even on a brand new or freshly-paved track that doesn't have all that scuffing.
There's some basic, generalized methods like out-in-out that the license tests teach, but beyond that it's just trial and error. You approach a part of the track, see how your approach worked out, and then try it a bit different the next time to see if that was better or worse. Try braking at a certain point, and if it felt like you slowed too early or too much, try braking later next time. Conversely, if you had trouble making the corner, perhaps you braked too little or too late, so try it sooner next time. Stuff like that.