The answer is: it's complicated. That's why we have courts. We don't even have it sorted out for human drivers yet; if you kill someone with your car, you may get off without even a ticket, you may end up in prison for manslaughter. I honestly don't think robotic drivers add any complexity: there's already infinite complexity ;)
As for liability, there is already generally strict liability when products malfunction. If the product didn't malfunction, then that would mean someone else was at fault, and the cases where there was no malfunction and no one else at fault should be rare. Regardless, there's a huge body of law out there regarding product liability.
Once again, I'm assuming that autonomous vehicles deliver on the safety promises. If they become as safe as a lot of people think they can be, there will be so many fewer accidents that I don't think insurance and liability will be as big of an issue as they are now for human driven vehicles.
It's also pretty likely that whatever framework develops to license the systems will address liability (I think by requiring the operator of record to insure the vehicle).
All precedent is that auto manufacturers are responsible for manufacturing defects that lead to injury or death, not the owner or driver. Even the term "operator of record" has new meaning in the fully autonomous era. Bottom line if software bugs cause injury it's the software writers that are responsible.
You mention many problems with human drivers. But software has been known to have bugs too, and the world is an almost infinitely complex learning environment. It is most likely that the safer future will involve the intersection and mutual augmentation of these two control systems, not the swift replacement of one by the other. As is the case for example with aircraft.
How often is the driver in those cases under insured? I also wonder how often criminal charges pop up for drivers that weren't being negligent.