It happens to me a lot, however I am using a PowerMac, Sometimes the app (if any) you are using needs to close, or you can try relaunching finder, Command+Option+Esc. Sometimes what I put the computer to sleep, then wake it, and then it lets me eject.