If multiple networks have the same SSID, any device that has connected to one of these networks before will attempt to connect to whichever of the networks has the strongest signal strength. If the password is the same as the first network the device was connected to, it will connect to it. However, if the password is different, or if one network has a password and the other doesn't, it shouldn't connect.