How do governments pre-order coronavirus vaccines?

One of the leading efforts to find a coronavirus vaccine has run into difficulty, as AstraZeneca temporarily halted trials. Billions of pre-orders have already been placed with a number of pharmaceutical giants - but how do governments decide which companies to invest in?