First, you'll need the development environment, which includes an editor and a compiler. I like AVR Studio 4. They have a much newer version, but I don't like it as it's incredibly bloated for what I do.
Search the web for AVR Studio 4. Atmel maintains an archive of older versions. Download the latest version of 4 (this should be version 4.19).
Run the setup. The defaults should be fine.
Now install WinAVR. This contains the actual compiler we want to use (avr-gcc). Get it here:
If you're running Windows 8 or higher, the Make in WinAVR won't work as distributed. Download this file and install it in winavr's util/bin directory after installing WinAVR:
To compile an existing project, open up the (projectname).aps file in the project's directory.
Under Project/Configuration Options, go to Custom options and uncheck "Use AVR toolchain" then set avr-gcc to your path to avr-gcc.exe from the WinAVR install. It should be
Similarly, set the path to make.exe. It should be:
You should now be able to hit Build/Build and have it compile. Your HEX file is the end goal, it should be in the "default" directory. Now you can put that into your chip and try it out.