The 2 most important things are the stopwatch and how your gear selection might affect race strategy… sometimes the gear that gives you the fastest lap time on your own will allow someone else to make an easier pass down a straight or with the draft and block you in the corners, making it harder to gain the position back from them.
Apart from that, “highest RPM at the end of the longest straight” may or may not apply – it is generally a good starting point, but where you go from there depends on the engine and the track. And it depends on how you define “highest RPM”… point being that you’ll always hit your highest RPM at the end of the longest straight, even if you have the “wrong” gear. The key here is knowing your engine’s “maximum potential RPM”.
As for my observations with the engines I’m most familiar with…
With the traditional 100cc 2-cycles, without any form of rev-limiter, more often than not, if you hit the engine’s max potential RPM just before the end of the longest straight, you were in the ballpark.
With a Briggs LO206 and it’s 6100 RPM “hard” rev-limiter, it can be all over the map. There are some tracks where you will want to hit the rev-limiter in the middle of the straight, some where you will want to hit it almost immediately upon getting onto the straight, and others where you will want to barely hit it at all.
With a Rotax Max, which is rev-limited as much with ignition timing as anything, it’s again more like the Briggs. There are some tracks where you’ll be fastest only pulling 12,500 RPM, even though the engine can hit 14,500+.
It all goes back to starting somewhere and testing to see what gets you the best results. Daryle’s advice is great. As he says, drop a couple teeth, and see what the stop watch says. If it was the wrong way, add a couple teeth.
The only other comment I’ll add is that if your carb isn’t properly tuned, you may never hit your max potential RPM, so you could end up chasing gearing when your real problem lies somewhere else.