You can use almost any image editing program to create them. A simple cut and paste will place any image as an icon. The Mac OS will automatically resample the image down to conform with the 32 by 32 pixel size and also fills in all the smaller and different versions of the icon so it will function just like any other icon. Serious icon designers use many different tools in the creation of icons. At the core of any icon designers tool box is a program that will allow the editing of resources.
Resources are containers for different elements of a program.
The most common and free resource editor is ResEdit from Apple. You can use it to take a look at the innards of applications or some files. ResExcelence is a site dedicated to resource editing. Where cutting and pasting in the 'Get Info' window is effective for simple moving and creating of basic icons, ResEdit allows you to edit each element of an icon pixel by pixel. Some icon designers boast in the fact that they only use ResEdit in the creation of their icons.