The duration of a race varies according to the distance to be covered, the weather conditions etc...
The first competitor's finish time determines when the finish line is closed. Once the winner crosses the line, we take half his race time : this is the time other participants have left to finish.
Here's an example
On a round-the-world race, the first competitor finishes in 74 days, 16 hours and 59 minutes. The finish line will then close 112 days 5 hours and 28 minutes after the start (1.5 times the winner's time), i. e. 1 month and 8 days after the winner finished the race.
This rule may not apply in certain cases. (Stage races, records...)