Connect to network says "Connection failed" but it actually isn't
I had the same problem. I could connect although it said "connection failed."  I observed that my network was also not in the preferred networks list. 
I resolved the problem in two steps. 
I manually entered my network's name and my networks password to keychain list. After that, in the system preferences advanced window, I manually added my network to the list of preferred networks by clicking on add button (+) and dragged it to the first line of the list. 
I hope this helps.