You were undoing/doing up a bolt, right, and it sheared off, and now you don't know what to do because you need that bolt in there. Right, first point of call is a humble device known amongst other things as an "Easyout".
A bolt has sheared off during removal,
vibration and rust will do that.
If the bolt is steel in an aluminium thread you are in luck, it is usually pretty easy. In a steel or cast iron thread it gets a bit harder. You'll probably botch your first attempts until you get a bit of experience, so it is good to have some non-critical failed bolts to start with.
There is no magic here, an easyout is a case hardened tapered reverse thread screw. Yep, righty *loosey* lefty *tighty* instead of lefty loosey righty tighty. Don't buy a cheap one, get two or three different sized ones and pay some dollars for them. If you think getting out a snapped off bolt is hard, you need to try getting a snapped cheap easyout out...
Different sized Easyouts.
First you'll need to drill a hole in the sheared off stub. Carefully drill as big a hole as possible. The bigger, the less likely you will snap the easyout. How deep?
When you are a few mm in, put your easyout in the hole and see if the tip of it is touching the bottom of your hole. You want it so the easyout goes into the hole and is well clear of touching the bottom. This is where selection of drill bit size against easyout is important so that you don't have to spend half a day drilling a 20mm hole.
Carefully drill a hole in the thread.
Splash in some penetrating oil as you go, you know, the degreaser/water-displaying oil in cans, not only will it cool the job down, help the drill bit in but it may also loosen the stub somewhat.
Now the hard part. Put the easyout in place and tap it in with a hammer. Just enough so it is really stuck and biting in the hole. Put your little trusty adjusty spanner on the end and lefty loosey.
With some initial force, the stub with crack from its seat and unwind out just like it still had a head on it...
Crack it...but don't "Crack" it.
Oh no, I put too much force on the easy out and it cracked off in the stub! First, try to get the tip of the easyout out of your stub however you can. If it is stuck hard, and it probably will be, you'll need to drill it. Easyouts are hardened so the same drill bit you used before won't work, you'll have to use a masonary drillbit.
If you can get out the tip of the easy out, try again maybe with the next sized up easyout.
Why did it break?
Perhaps you didn't drill a big enough hole to use a really big easyout (the bigger the easyout the stronger it is), perhaps you bought a cheap and nasty easyout, perhaps that stub is totally rusted in place and will never see the light of day again. Remember, the reason why it sheared off in the first place is because the lower part of the thread is stuck...
Success! Now to find a new bolt...
Options if easyouting didn't work? If the stub is poking out a bit you can try welding some bar to the end of it to act like a spanner. You can drill the stub and hole completely out and tap a new bigger thread to suit a bigger bolt. Or you could use a helicoil to continue using the same bolt size (look up helicoil). You could also drill the whole thing out and use nut on the back end, forgetting about the thread altogether. That's only possible if you have access to the back of course. Welding of course can be a permanent solution, be careful though, vibration is the enemy of, well, everything.
Hopefully however like me, the bolt sheared becuase it was just old and weak and you have the offending stub removed ready for a new bolt to take its place :)
Next time you are tackling a bolt that looks a bit dodgy, hit it with some penetrating oil the night before in an attempt to avoid snapping it off!