There are very specific rules to using tyres in an F1 race and here it as simple as possible:
First, there is one tyre provider for all the teams. Pirelli has been the provider since 2011.
Every race Pirelli provides 3 tyre compounds made available for all the teams in equal quantities. They are color coded, Red (the softest compound), Yellow (medium compound) and white (hard compound)
The harder the compound the slower the tyre is but the longer it lasts. The softer the compound the faster the tyre is and shortest it lasts on the track. So, the teams must find a balance between speed and distance since they are forced to use at least 2 compounds during the race, even if one of the compounds was used for only one lap it is fine as long as they use two types.
But what if it rains, you may ask!! Well, this is also covered, there are two types of tyres for wet weather. They are marked with Blue color for very wet surface (the tyres are called Full Wet or extreme weather) and Green marked tyers (called Intermediate tyres) for when the track is not so wet but still holds water (damp surface).
Tyres plays a very important role in who wins a race. This is no truer than the final race of the 2021 season that saw Max Verstappen overtakes his rival Lewis Hamilton on the last lap of the race to win the title for 2021. All was possible because Max had a fresh set of tyres on his car and Lewis’s were a very much used set that could not keep up with the Red Bull car despite the speed advantage the Merceds had.
The hotter the tyres get the more grip they provide which means that cars can go through corners much faster than in colder tyres.
“the softer the compound of the tyre the more grip it produces”
Also, as said earlier, the softer the compound of the tyre the more grip it produces so a hot lap (fastest possible) on a Soft Tyre would most probably be the fastest the car can go around that track, so this Red (soft Compound) tyres are usually used for Q3 to insure the driver starts as high up the grid as possible.
During the race the driver needs to pace his speed according to the tyres being used. Running very close to a car in front would actually force the car behind to eat up (consume the rubber) much faster than if the driver had no cars in front of his (this is called running in clean air in F1).
F1 cars are designed in a very specific Aerodynamic way to make the car stick to ground as much as possible (to corner faster) and at the same time to have as little as possible of air resistance while driving in straight lines at top speeds.
There is always a compromise between the two factors and that usually is what the teams do during the 3 Free Practice Sessions before the Qualifying. They only work on finding the right balance for each track between straight line speed and going through corners as quickly as possible.
The teams also use some of their time in these sessions to run race simulations, so they fuel the cars with the same amount to cover the full race distance and they have their two drivers test how fast they can run with such a heavy car and on which tyres would they be able to make the best time during the race.
The practice sessions are usually run on Friday (except in Monaco on Thursday) for 2 sessions and then one session in the morning of Saturday before the qualifying session.