How is placing determined at the beginning of a race?
Just as you said, it's completely random. There's no rhyme or reason to how the game places you in each match, as you can restart the race, and start in a completely different position than you were in previously. You can start a race with the highest possible race point multipliers in all 3 categories (racer, glider, kart), and still start in last occasionally.