When selecting wands, Ollivander does not seem to randomly pick boxes from his collection. How does he know which wand might be the right one?
While the wand chooses the wizard, a knowledge of wandlore can help predict which wand would pick which wizard.
Taking from Olivander's notes on the subject:
In my experience, longer wands might suit taller wizards, but they tend to be drawn to bigger personalities, and those of a more spacious and dramatic style of magic. Neater wands favour more elegant and refined spell-casting. However, no single aspect of wand composition should be considered in isolation of all the others, and the type of wood, the core and the flexibility may either counterbalance or enhance the attributes of the wand’s length.
(Pottermore - Wand Lengths and Flexibility)
Wands choose the wizard or witch in a way that is neither random, nor serendipitous. There is much ancient mythology and botanical knowledge regarding the powers and natures of wood and other natural elements. Wandlore, Harry Potter Wiki
This would be one of the insights an experienced wandmaker would use to know which wand could be a better fit for the wizard. But most of the time, it would be a trial and error. Also, most of the wands corresponds to the birth month's wood in the Celtic calendar, so that should really eliminate most of the extraneous candidates.