Many people have reported problems with their iPhone 5′s Wi-Fi. According to this Gizmodo blog post the problem might be with the setting of your Wi-Fi routers. The newer WPA and WPA2 encryption technologies are better than WEP but it poses some problem a few devices. Theoretically, if the latest WPA-enabled devices are facing some problems they can automatically switch back to WEP. The problem with iPhone 5 seems to be that it is not able to automatically switch back, so you will need to do it manually. But be warned, WEP is less secure compared to WPA so use it as a temporary solution until Apple comes up with a patch up.
All you have to do is log on to your router gateway (for Linksys routers it should ideally be 192.168.1.1), go to Wireless and Security options and select WEP instead of WPA. You can get more details in the above-mentioned Gizmodo blog post.