Go to Settings... Then Wi-fi... Turn Wi-Fi on.. You should see any available wireless signals listed. If there is a little lock symbol, it means it's a secured network and you will need a password/key to access it. If it is your own network and you see a lock, it is protected and entering your key may not work. The trick is.. to identify the type of security you are using. The iPhone's security must match the network. Your choices are WEP/WPA/WPA2 and the enterprise versions of WPA/WPA2. I normally choose WPA2 and use something simple to remember like my cell phone number or a similar number. This has to be set up in your router. You should be able to use 192.168.1.1 or 10.0.1.1 to access your router. These addresses change depending on the brand. Go into wireless security and set your type of security. If it's WEP, I would strongly suggest you change it to WPA or WPA2 at this time. It will save you the hassle of remembering this long randomly generated key. You may have to reboot your router after changing this setting. It will let you know.
Now go into your iPhone Wi-Fi settings.. I've found that even if my wireless router shows up, it sometimes won't let me just click on it to connect. This is usually because the default settings for security don't match the router. Go to OTHER... Type in your wireless SSID exactly. (This IS case sensitive), Press on the security line..Select WPA2. All it will do is put a check mark on it, then press Other Network to return to the Wi-Fi page. At this point you can type in the security code you set in the router. Then just press JOIN at the bottom. If all goes well, you will be connected to your wireless network.
Some networks are unprotected and you can access them without a password. Some networks show as unprotected but want you to go to a internet gateway to accept the owners terms and conditions. This is true in cases such as hotels. Simply open a web page, it will open on their gateway page. Supply their user name and password and you should be connected until you disconnect from it. Then you will have to go to the gateway again.
I hope this helps someone who is having trouble connecting to Wi-Fi on their new iPhones.
Regards.