Update it from iTunes on a computer as described at the bottom of this article; devices running an iOS version prior to 5.0 can't be updated straight from the device. It will be updated to the newest iOS release supported by the device’s hardware.
If you wanted 5.0 exactly and not 6.1.3 for some reason, it's too late.
It is too late to upgrade to iOS 5, but you can upgrade to 6.1.3. See below for instructions.
If your iDevice is using a version of iOS lower than 5, you will need to use iTunes on your syncing computer to perform the upgrade. Use the Apple link below as a guide for the upgrade.
Also read the instructions from the section entitled "Update your device using iTunes" at the link below.
Information regarding transferring purchases from your iDevice to iTunes on your syncing computer can be found at the link below.