I have an Edimax EW-7811Um USB wifi dongle, and I regularly follow the instructions here: https://github.com/retropie/RetroPie-Setup/wiki/Wifi#method-1-easiest
The problem that I encounter is that when performing the initial setup, it regularly fails after I enter my wifi password. My solution is to just keep trying until finally the script recognizes that it connected successfully. It can typically take anywhere from 3 to 7 attempts before it’s successful. From that point on, the system has zero trouble connecting immediately.
This makes me wonder if there isn’t perhaps a timeout problem or something in the script when it tries to determine if the initial connection was successful or not.
you can always try rebooting. When you type your password it adds it to wpa_supplicant.conf even if it doesnt connect right away. the script refreshes the network once you put in your password so sometimes it takes some time to connect. reconnecting the network service can be a tad buggy but if you reboot it usually loads up fine.