Yes, even if you only have a layover and don’t leave the airport, you are required to have a valid ESTA. People travelling through the USA are still considered visitors of the United States by the US authorities and are therefore required to hold a valid US visa or an ESTA travel authorisation. Simply enter 'In transit', and your final destination under the heading 'Address While In The United States' on the ESTA application.