Does not work 'out of the box' in Arduino, you need to install a lib following these instructions (source)
There are many different ESP8266. Take care to choose the right one in the Boards menu.
There is a common error :
warning: espcomm_send_command: can't receive slip payload data
If so, you need to install a python script and modify a few files, following the instructions : https://arduino.stackexchange.com/questions/20219/upload-with-esptool-fails-with-espcomm-send-command-cant-receive-slip-payload