Having your iPhone malfunction to the point that it needs to be restored to factory settings is bad enough -- losing all the apps you paid for would be worse. The good news is that as long as you still have access to the Apple ID you used to purchase the apps, you can download them again without paying. The bad news is that you're not getting the data from that app back unless you've made a backup either through iCloud or through iTunes.

Re-downloading Your Apps

Launch the App Store app and ensure you're signed in to the correct Apple ID. Tap "Updates" and then tap "Purchases." Select "Not on This iPhone" to see a list of all the apps you've ever downloaded from the store that aren't currently installed on your iPhone, whether they were free or you paid for them. Tap the "Download" icon by an app in the list to download and install it again. If the app you want is not there, run a search in the App Store for it -- it may simply no longer be available. If it's still there, you likely bought it using a different Apple ID. To download it without having to pay again, you'll need to sign out of the Apple ID you're currently using and sign in to the store using the one the app was bought on.