The countries that earn two or three spots are given theirs first.
Of the remaining spots, they go to the highest ranked countries not already listed.
So in mens, for example: Canada and Japan get three spots. Five nations (Spain, USA, Kazakhstan, France, Czech Republic) earned two. So of the 24 spots, 16 are already spoken for. Germany, China, Uzbekistan, Russia, Sweden, Belgium, Austria, and Estonia all earned on spot.
For the Olympics, there are 30 spots. So six spots (or more, depending on whether nor not all nations use the second/third spot - Spain didn't this year, for example) will be decided at Nebelhorn.
An insane line-up where 1+12, 2+11, 3+10, etc all come from the same countries and earn three spots, that means that the ladies from 13th-18th would earn one spot for their nation (as long as they don't have representatives in the top 12). So basically, 18th is the lowest you can rank and be guaranteed a spot.