It depends on your mode of travel. If you are traveling by land, you do not have to apply for ESTA. If you are coming to the U.S. by air or sea, you DO have to apply for ESTA.
https://help.cbp.gov/cgi-bin/customs.cfg… ..
Should you plan to take a flight or arrive on a vessel you will need a prior travel authorization (ESTA) to be applied online on the website of the U.S. Department of Homeland Security.
http://www.cbp.gov/xp/cgov/travel/id_vis… ..
The ESTA is not required for crossing a Canadian - U.S. land border. All you need in this case is to obtain a form I-94W at the border at a fee of $6.00
https://help.cbp.gov/cgi-bin/customs.cfg… ..
The ESTA is easy to get and it is free of charge. It only takes a couple of minutes. All you need are your passport details, an e-mail-address and your telephone number. The address and flight details data can be omitted since those information is not mandatory for an ESTA approval. You can apply for the ESTA whenever you like to; it will be valid for two years or until to the expiration date of your passport.