What to do if you can't get connected to WIFI or your connections are funky.
There are several things you can do if you can't get a good connection to your WiFi hotpot or router. (some of this advice may help with other WiFi devices as well so other non S4 specific suggestions are included.
1). Some channels work better than others. 1 and 6 are popular and work well for many people. If you can get connected at all, download WiFi Analyzer (here) This app will give you an idea what channels may be available or over lapping with a nearby router.
2). Restart your router. This sounds simple but has been the solution for many people. Routers frequently accumulate garbage in the system that can be dumped by removing the power cord for at least 30 seconds then plugging it back in. After the router has made a connection, restart your phone or go to settings > WiFi, find the connection and a long press will allow you forget the connection, then connected again. You also should check to see if there is a firmware update for the router. That could make all the difference. In a few cases some people just replaced an really old router and ended up really happy they did.
3). As is the case with some other devices, some Android phones & tablets don't do a great job of telling you there is an error when inputting your password or passphrase. If your S4 says it is trying to connect for more than 10-15 seconds you may have mistyped the required information. It's also possible it may just say "saved" and do nothing. Long press the connection and tell it to forget your credentials and try again. If your phone at some point says saved but you are obviously not connected, you may have a poor signal from the router or you are too far away, or there is other interference or it can also happen at times if can't authenticate with the router correctly.
4). I have found that the most Android phones & tablets don't work well or at all with WEP encryption on some routers, though some do work, so your may want to try using WPA/WPA2 or equivalent. This is better security than WEP anyway. If you still can't connect but see a strong signal try no encryption long enough to determine that it is possible to connect and adjust accordingly.
5). In order to narrow the problem down, if all else is failing, try connecting to a public hotspot or a friend's router.
6) If 1-5 don't help, turn your S4 completely off and back on.
There are some things you can do to improve your WiFi. Cordless phones typically operate at 2.4 GHz, so do most of the tablets and some phones. Keep cordless phones as far away as possible from your WiFi router. Same applies to a microwave oven. The especially applies if you have an older G only router.
Note that there have been issues, particularly with some Belkin 615 and 655 routers. If you can't get a reliable connection try changing your security to TKIP.
Additional suggestions welcome.