A lot of people will prefer now to use Arduino IDE for this. Alternatively you may use:
First you need a firmware file. You can build one yourself with the Toolchain or download one:
To flash the ESP8266, you'll need first need to wire things up. See start-with-esp-12-arduino -> Hardware for the basics.
Connect GPIO 0 to ground and reboot the ESP8266 to enter flashing mode.
Arduino now offer a third party plugin to use the Arduino IDE for different CPUs. See step by step instructions in Start with the ESP-12E and the Arduino tools
The NodeMCU flasher is designed for use with the NodeMCU firmware, but it can also be used to flash other firmware files. Windows-only currently, but a cross-platform version is in the works.
See ESPtool on Github and Christopher Rust's accompanying YouTube tutorial. However, if you don't want to use a Python-based tool, there are two other command-line tools on Github: Christian Klippel's esptool-ck written in C for Windows, Linux and OS X, and Don Kinzer's esp_tool written in C++ with makefiles for Windows and Linux (also includes a pre-built Windows executable).
All three command-line utilities perform the same basic functions but the invocation syntax is different for each. Kinzer's esp_tool utility can also build a sparse combined image file meaning that most of the “filler” between the actual image data components is omitted. Omitting the filler can significantly reduce the Flashing time while still providing the benefits of a combined image file.
For NodeMCU or MicroPython, use ESPlorer or NodeMCU Studio to upload the Lua or Python scripts after uploading the initial firmware.