Sometimes one might face a problem connecting with the WiFi even though it was setup initially. It will show that it is connecting but for some reason it will not be able to connect. In this case one should follow these steps-
1. Goto Settings.
2. Goto WiFi
3. Click on the WiFi network which you were trying to connect.
4. Click on the Information icon on the right.
5. And click Forget this network.
6. Allow the network list to refresh automatically once.
7. Click on the network name.
8. Enter the network key or password.
9. And press Join
Now you should be able to connect to the network 🙂