The only possible cause is that there is a problem with the connection in that either the connector on the drive was damaged or the connector on the laptop was damaged.
The "safely remove drive" only ensure that all data is flushed to the disk. The worst that can ever happen if you don't do this is the file system can be left in an inconsistent state, and in some cases, usually with fat32 drives, the filesystem will show up as RAW.
It can never cause these symptoms. Chances are the driver can't install because one of the traces inside is disconnected,cracked or otherwise not always a closed circuit, the device is detected, but windows can't install a driver because it's unable to find out what the heck the device is. (or something to that effect). You could try giving it a bit of a nudge in the opposite direction it was pushed before. I had a similar issue... except my laptop fell of a short table and pretty much smashed the USB drive that was plugged into it's rear. I was able to piece it together and hold it in place long enough to copy everything off it it with my free hand eventually, however a few attempts failed because the jigsaw puzzle that was my USB drive lost cohesion/started to fall apart. What errors did I get? A device attached to this system has stopped functioning" and if it happened during the detection phase, the same error you got.
What am I supposed to do, take it apart? I looked at it, I'd have to break the plastic.
I think it's important to recognize internal damage as a possibility, despite the logistical implications. At this point, the drive may very well be a lost cause in the long term; it's highly likely that it has suffered physical damage, sometimes even the slightest bend can break a trace.
I think the problem is it disconnected and reconnected several times... you know how you're supposed to always 'eject' flash drive s before disconnecting them?
An understandable connection, but that is only to prevent the scenario, which is unlikely, that some unflushed data has not been written to the drive. And to make sure there are no open handles on the drive. The only thing it prevents is file system corruption; nothing like this could possibly result from constant reconnections.