The trick is, to do the restarts and sign outs in a particular order. To try to get everything in one shot, just try this first. Go to Settings > iTunes & App Store and sign out. Then go to Settings > General > Reset > Reset Network Settings.
Once the phone is restarted, connect back to your Wi-Fi or make sure your cellular data is working. Then go to Settings > iTunes & App Store and sign back in. Once done try to download the app again.
If that is still a no-go, your best bet is likely back up the phone in iTunes or iCloud and erase it. To try to catch any additional errors, I would recommend restoring the phone with iTunes on a computer. Once restored, restore the backup back onto your device and see if you can get that app downloaded then, if it did not automatically.