Here's a breakdown of how I just won by 13 seconds on my first try, with 2 spins, an extra pitstop because the AI rammed me into the pitzone, on the wrong tires basically the entire time, with the AI on hardest difficulty in the options.
I purchased everything I could at the tuning shop while staying within the guidelines. For the race, when it was dry I ran Fuel Map 1 and typically upshifted at the midway mark instead of letting it rev out. I also tried to use higher gears for stability and fuel saving around almost every corner. Down the straights, I'd go up a few fuel map levels if in someone's slip stream. When it was wet, I ran fuel map 3 with the same shifting strategy. For tires, I ran hards when it was dry but mediums or maybe even softs would be a better choice here, as I had zero tire wear every time I came off of hards. When the first rain came in, I pitted straight away, but I likely could have gotten another lap in before it amounted to anything. I went with wets, as it looked like the rain was there to stay, but inters would have been a better choice. When the rain went away, I pitted back in for hards. Next lap, I got rammed into the pitzone by the AI and just topped up the gas. When the rain came again, I switched to inters, when really I needed wets this time, because the rain stayed for about 20 minutes. I spun it twice during this period, but was fairly fortunate as it didn't cost me a load of time. I pitted once again for hards when the rain stopped, but should have waited one more lap because the track didn't dry quickly. When I finished, there was only 1 AI on the same lap as me, so I think there's only 1 of them pushing hard.
TLDR: If the weather is fairly consistent, the best strat would be to conserve fuel through early shifting throughout the race, Fuel Map 1 when it's dry, Fuel Map 3 when it's wet, start on mediums/softs, go to inters, back to med/soft, then to wets, then to med/softs.