While many of the causes above apply here too (see What could prevent my device connecting to a network?) there are a number of more specific issues that could be affecting your phone’s connection to WiFi.
Firstly, check WiFi is switched on in your phone settings. If it is, the problem may well be with the router. Router’s aren’t particularly clever and may ‘forget’ that your phone is there, so turning your phone off and on again might help it take notice.
If it’s a private WiFi connection, the router might need resetting so try turning it off and on again. If this doesn’t work, try making your phone ‘forget’ the network and then reconnect to it by selecting it on your phone and entering the passcode again.
It’s worth checking if other devices, such as tablets and laptops, are working with the same WiFi connection that you’re having problems with on your phone. If they do work, try turning these devices off and seeing if this makes the connection to your phone work. If it does, this suggests that there may be some kind of conflict within the network.