For my second Raspberry PI, I didn't want to hook it up into a monitor and keyboard in order to configure it and enable WiFi. This post covers how to get this done via SSH only.
At this point my RPi was set up and connected to my router via an Ethernet cord and I could already SSH into it. If you need to set your RPi up, check here first.
Issue sudo vi /etc/network/interfaces and verify it contains the following:
auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
Add the lines if it doesn't have it.
Hit shift+ZZ to save and exit, and then issue sudo vi /etc/wpa_supplicant/wpa_supplicant.conf and set it to the following:
After this restart the RPi by issuing sudo reboot. Ideally you would be fast enough at this point to unplug the Ethernet cable. I wasn't, but it is not a big deal.
On my laptop, I went to the homepage for my router (Cisco/Linksys E1200), which I found by opening up a command prompt and typing in "ipconfig", looking for the value of Default Gateway, which for me was 192.168.1.1. On the webpage, I clicked on the Status tab, the Local Network sub-tab, then the DCHP Client Table button.
Here I noticed two raspberry pi's with the same host name. This was because I didn't unplug my Ethernet cable fast enough. One was 192.168.128 and the other was 192.168.129. SSHing into the .128* did not work, but the .129* was fine.
I SSH'd back into my RPi, and issued ping www.google.com to verify that I could connect to the internet. I could not: I received a network unreachable error. I issued a sudo reboot and it worked after that.