There are a total of 38 races within the game that will either involve running, driving or flying through a certain number of gates or to either destroying a certain amount of targets within a time limit.
To track the ones you've completed and the ones you have left remaining. go into your Holoprojector, scroll to Missions, and click on the Trials tab. You need to get a Gold medal on them all, rather than just completing them. They're not too difficult, but some may take more than one attempt so you can memorize the route you have to go on.
If you haven't unlocked the specific race, you either need to progress through more Episodes in the main story, or you can purchase the rumour for the race which usually costs around 30,000 studs. If you've collected the stud multipliers extra from the Datacards then you'll probably have billions of studs to spend, so it shouldn't be an issue to purchase the rumour for the race if you haven't discovered it naturally yet.
There are some races in which you need to complete a side mission in order to unlock the actual race. Those will appear in red, and will usually tell if you've purchased the rumour for the race which side mission you need to complete in order to unlock it.
Additionally, there is an instance for the race "Hangar Bout" on Naboo (Theed), in which after you buy the rumour it will tell you no details are available for this rumour. If you get this, that means you need to talk to the mission giver (some Theed guard who is in the hangar where you spawn when you fly into Theed) as someone who is disguised as Theed guard or Captain Typho (Hero) who is already a Theed guard. If you go up to mission giver guard as either of those, then the trial will appear right beside you.