Welcome to GTPlanet, yanogore: You can only get the optimum racing line when driving the license tests, and by pressing R3 at any time. You can toggle it on and off (blue for acceleration, red for braking, white for off-throttle).
It does not work in the races, you just have to learn them yourself. Previous GT games had a darker racing line (it's clearest in GT2, in my opinion), as well as in the original GT and GT3. But for in GT4, Polyphony Digital introduced a "more-or-less" real-life racing line, since there are also tire marks showing how to run off the track. It's not always accurate for every car, and skid marks are sometimes placed to fool you more than help you.
Your best bet is to practice the license tests and practice, practice, practice... GT1 through GT3 had manuals going over the basics of car control and racing lines, but GT4 sort of short-changed the buyer. Do a search on our boards to read up on car control and racing lines, and maybe even watch some real road racing on TV for an idea of how it's done.