Update files for iPhone iOS are distributed through Apple Internet servers to iTunes on the users computer. iTunes keeps last update file stored in the computer, because it is also used for iPhone restore process, should users have software problems with their iPhone.
Default iPhone firmware location in Windows:
Users\<UserName>\AppData\Roaming\Apple Computer\iTunes\iPhone Software Updates
Default iPhone firmware location on Mac:
Users/<UserName>/Library/iTunes/iPhone Software Updates/
iPhone firmware files have IPSW file extension (the .ipsw file is basically a ZIP archive that contains Apple's DMG installation images with actualized iOS, updates, fixes as well as installation settings and system files).
To view the content of an .ipsw file, rename ISPW file extension to ZIP, start any compression utilities you have installed in your computer (WinRAR, WinZIP, Stuffit Expander etc.) and extract the file.
IPSW files are also used to customize iPhone with Jailbreak options. Utilities such as PwnageTool and Redsn0w are able to edit the IPSW archive and activate functions that are disabled in official version of iOS.
Unfortunately, every version of iOS can't be jailbreaked, and iTunes is able to download only the last version of iOS from Apple update servers. However, if you need a version of iOS that is not available on iTunes, you can find it on iPhone fan websites, where various IPSW archives are stored.
Where to find IPSW files for iPhone?
Internet servers iClarified and Felixbuns.de store archives with official ROMs for all versions of Apple iPhone. Simply select the version of IPSW you want from the list and download it.
How to open IPSW file in iTunes
Afterwards, you can open iTunes and manually select the .ipsw file with iOS version that you want to install. To manually select IPSW file in iTunes for Windows, hold down the Shift key and press the Restore button. On Mac hold down the Alt key and also press Restore button.
Original iPhone can only be upgraded to higher version of iOS, which means that you can only install newer version of firmware to your iPhone. If you want to downgrade iOS you need to have a backup of Apple iPhone ECID SHSH data of this exact firmware version.