Yes, it's unfortunate that Joomla allows itself to get into an impossible situation with extensions. If the install fails at certain points (which can easily happen) then Joomla thinks the extension is neither installed nor not installed. It is impossible to install again, but it is also impossible to uninstall it. Usually the only option is to go in and delete the files and directories belonging to the failed extension.
Another consideration is that there are a number of faults in the Joomla installer. A couple of them are discussed at
http://php-ace.com.
There is no sure fire way to combat this - it hits me regularly - although one factor that makes for a smoother running CMS is to make sure that you use hosting with PHP running as CGI and some form of suexec. That runs all the PHP scripts as the site owner user, rather than the Apache web server user.
Otherwise, the only option is to try to find extensions from reliable sources, although I have to admit that my own extensions can occasionally fail during installation