There is a whole science devoted to finding the best gear ratios for the race cars and the optimal time to shift gears. There are scientific papers, online calculators, tables, graphs, etc... However, they all apply to vehicles with internal combustion engines and multi-gear transmissions which have totally different power torque curves from what we try to model here.
Electric motor has a limit of maximum power it could provide and by choosing the gear ratio you could either maximize the torque or the velocity you get from it, but their product is limited P= τ*ω
Lets try to find the optimal gear ratio that will give you the fastest time to cover the distance S.
First, the vehicle accelerates during time t1, up to the maximum velocity Vmax, then it takes additional time t2 to reach its destination at constant speed. The shaded area on the graph corresponds to the total distance vehicle covers. The slope of the first step corresponds to the acceleration of the vehicle. Effective force out of drivetrain minus the force of friction goes to accelerate vehicle of the mass m according to Newton's law F=m*a. Note that Vmax is always less than Vidle that you would get if there were no friction.
Since by picking optimal gear ratio you can choose between max speed and max torque (force) we need to find the optimal ratio between t1 and t2 to minimize total time it takes to cover distance S.
According to my calculations (which you should definitely check, because I could have made a mistake) the total time of the trip Ttotal = t1+t2 = (m*Vmax^2)/(2P) + S/Vmax. If you plot both components on the graph you could see that minimum travel time time corresponds to some value of Vmax = Voptimal. My guess is that vehicle needs to accelerate for the first 30-50% of the trip and then drive at that constant speed Vmax. Exact values would depend on the distance S and amount of the friction in the drivetrain and the mass of the vehicle.
Another important note is that as the vehicle accelerates you don't want to sent max power to the motors right away, because they will overheat PTC and lose power before reaching the destination. Instead you want to apply a slew rate control by gradually increasing the motor power. For example, in 10 power unit increments per step. Where optimal time of the step could be determined experimentally.