AI cars will pit as soon as their fuel indicator goes to yellow. If you want to make the cars pit at different times you have to adjust the fuel in the individual car.ini files.
Code:
[FUEL]
CONSUMPTION=0.0067 ;0.0117 ; fuel consumption. In one second the consumption is (rpm*gas*CONSUMPTION)/1000 litres
FUEL=100 ; default starting fuel in litres
MAX_FUEL=200 ; max fuel in litres ; max fuel in litres
Based on my experience with setting my F1 seasons, 20 laps is pretty much maximum for AC. And even then you get the backmarkers which is a real problem in AC (because there is no blue flag AI). AC just doesn't suit well to longer races.
I haven't played my seasons much lately as AC started to get really weird fastlane issues. But when I was tweaking these seasons, I noticed that AI doesn't care about tyres at all, they only pit based on how much fuel they carry.
And even then they might take one unnecessary pitstop even when they have enough fuel. Fortunately this only happens about 20% of the time if you have set the fuel amounts properly.
AND... very important: If you skip the qualifying, AI cars will pit completely randomly because AI cars require at least two full QF laps to determine how much fuel they need for the race. Just like the user. You need 2 legal qualifying laps to get this indicator to show up (like 30 liters / 4 laps etc).
Hope this helps.