grab onto what's left of the hex head- it's actually 5/16", not 8mm- with a vise grip and kind of wedge it sideways and twist it as you pull it out of the rubber insulator..
the new one goes in the same way- but make sure the new bolt is as long as the old one.. if it's longer, it will bottom out in some batteries and you will never get the cable tight and might even strip the threads in the battery as you try to get the cable tight, too short and the threads in the battery could strip out when you tighten it..