There's no luck involved. It's very much about understanding where you can push, and then learning to do it consistently. Take Brands Hatch as an example - you can go flat out up over Pilgrim's Drop, then all the way through Hawthorns, Westfields, Dingle Dell and Sheene, and at most, you might need a squirt of the brakes on entry to Sheene.
All you need to do is figure out where you want to be as you exit the corner. Pick your point of entry and aim for that spot on the exit. If it helps, break early to begin with, then push deeper into the corner with each subsequent pass through. The last corner on Red Bull Ring GP Reverse is a tricky little one. I started out braking at the 150m board, but within three laps, I found that I could brake at the access road just before the 100m board and still make the corner (the 100m board itself being too late).
It takes a bit of practice, but it can be done. Look for the markings on the road at the entry to the corners, which should give you a clue as to the fastest way through the corner. Try it on a circuit that you know and like, with a car you are comfortable driving.