For single races the grid positions are supposed to be random. For tournaments they are as trackripper says, i.e. the reverse of the finishing positions from the previous race.

However, sometimes the game gets confused and in single races the starting positions get stuck as exactly the same for a few races. Best to start a room if you notice that happening.