If your iPhone is failing to connect to a network the first thing you should check is if you are in range of a Wi-Fi router. You could be out of range because not all locations have Wi-Fi readily available. If you are in range of a network, but just aren’t able to connect to it, go to Settings and choose Wi-Fi, then turn it off and then back on. If it still isn’t connecting, check to see if your Wi-Fi router, cable and DSL modem are working properly because sometimes your iPhone won’t connect to a network if the network isn’t working for some reason. If that is the case, you need to contact the network administrator or internet service provider and let them know there is an issue.
If you know the network is working properly but your iPhone just won’t connect, restart it. When your iPhone is booted back up, go to Settings and choose Wi-Fi. You can then locate and choose the network you are connected to and tap on “Forget this Network”. After you have done that you can then try to reconnect to it. Make sure you know the password first though because you will probably have to re-enter it.
If you are still unable to connect, you might have to restart your router. Updating your iPhone and router to the latest software or firmware is also something you might have to do. If you aren’t sure how to update your router, call your service provider for instructions.
Source Apple Support