When you can trace processes which occupy drive there is no much problem (for example with mentioned earlier Unlocker small tool). However, sometimes this task is not so easy. There is no explicit handle bound with drive (Unlocker or Sysinternals handle or even process explorer won't show anything) but still Windows will not allow to unmount such drive. Advice like logout, restart or kill explorer seems a little exaggerated and hard to accept.
I have these issues mostly on HDD external drives than mere pendrives.
With pendrives you can use eject function from Windows Explorer drives list. When there is no explicit process then it will work.
With external HDDs there is much harder because there is no eject function. And if you check processes you won't find any handles tangled with drive. In reality, even if not shown there is one process which is blocking drive - system with PID number 4. You can trace it with event logger where system will write information that system process under PID 4 did block the operation. You can check if drive wasn't added to SystemRestore monitor (it's one of the reasons).
For other cases I am using simple script and tool USB_Disk_Eject from Quick And Easy Software.
The batch script is:
sync
net share %1$ /D
USB_Disk_Eject /REMOVELETTER %1
I was experimenting with one additional command
fsutil volume dismount %1
but it seems I didn't add it to main batch (not sure why).
Sync is a small Sysinternals tool which will force your drives to finalize write operations (from drive cache to drive).
I had only one case where above lines didn't work - it was AVG software and only logout help.