The ESTA must be requested at least 3 days before arriving in the USA, in case the authorities decide to carry out in-depth checks on your file. Ideally, we advise our travellers to wait for their ESTA before confirming their flight booking.. In the meantime, there's nothing to stop them from putting an option on how they get to the USA.
In the event of refusal (very few applications are concerned), you would then have to apply for a traditional visa in your passport, and submit your application to the embassy.