Even if you've set up thunderbird so that everything is working perfectly most of the time you occasionally end up in a very annoying situation: you keep on getting error messages about failed connections, and you keep being asked to supply the correct password. You can hit retry, or you can enter the correct password -- but why would you, given that you know based on previous successful connection attempts that your password is correct?
Leaving things along for 5-10 minutes tends to resolve it (or restarting thunderbird, given that you don't do it too quickly i.e. you basically let things stay quiet for a little while).
Anyway, while there are a number of potential reasons for this, in my case it's always been due to too many simultaneous connections, so that some of them are rejected. Not that that's what the error message really says, but whatever, the solution is actually pretty simple -- limit the number of simultaneous connections.
Go to Edit, Account Settings, select the account (typically a gmail one), Server Settings, click on Advanced, and change the 'Maximum number of server connections to cache' from the default 5 to e.g. 1.
On the computers I've done this on I've completely gotten rid of the annoying password requests.