The Roku will connect easily most of the time with many routers. As always if not you have to do the normal check list of things, like making sure you don't have MAC address set to accept only the devices listed, or that you are actually typing in the passcode correctly..
But there is a problem that appears to be distinctly with Roku only on very few routers, Actiontec or some models of Actiontec being one.
The Roku will see your router, it reads the SSID, but when you try to connect it fails. There are all sorts of fixes people have posted, like making sure ping is turned on, or that the router is set to "share" not "open." None of those is the problem normally.
For some reason on those very limited routers the Roku will not connect if the Router's gateway last number is set to "1" - meaning 192.168.1.1\ Unfortuneatly that is the normal way routers are configured. While other devices don't seem to have the problem, the Roku, or at least the Roku 2 XD does.
Therfore you need to change the Gateway to 192.168.1.2 - or 3 or 4. I used 4 and it worked immediately. Keep in mind if you have other wireless devices attached, they may now need to be reset to connect. Some of them may not, on their own try anything but the default gateway. You would then need to go into that device and change the settings to look for the gateway number you picked. Examples of devices that you would need to change is the Slingbox, or security cameras. Wireless smartphones should find it, but even some of them you may have go into settings and find where you can pick the gateway number.
Hopefully this will help someone somewhere.