How to fix a detached brake cable?
Without pictures or a better description, it's hard to know if it was a failure of the cable or the brake lever. If the brake lever has broken and can no longer grasp on to the end of the cable, you'll need to replace the lever itself. However, a more likely scenario is that either the nub on the end of the cable that the lever holds on to has come off. You may also have a lever where the nub can pop off of if there's no tension in the cable, which can happen if there's too much friction in the cable housings. This may also be caused by the cable having become detached from the brake: you're pulling the lever, but it's not attached to anything.

The quickest and easiest thing to do is try to simply re-cable the bike. This can be done quickly (time: 15m) and cheaply (cost: $10), and in doing so will also help diagnose if the problem is deeper. You should also go ahead and re-cable the other brake lever and the shifters as well — if this was caused by a failure in the cable, the other cables may be ready to fail as well.

To get the cable out of the brake lever, pull the brake lever until you can see the cable, or where it should be. Find where the cable comes out of the other end of the housing and push it through until it comes out through the handle. To replace it, just thread the new cable back through and clamp it on the brake. It should look like this:



If you feel a lot of friction pulling the cable out or installing the new one, you should replace the housings. This will take a little bit more time (45m) and some more money (housings: $10, bar tape: $15), but is still pretty easy to do. Unwrap your handlebars and re-insert the brake cable, replacing the old housings as you go. Wrap the handlebars back up, and you should be all set.

If the nub end of the brake cable isn't being gripped by the brake lever, or the piece to do so is missing, you will have to reinstall a new brake lever. This will be a good bit more expensive, and will also require that you re-wrap the handlebar tape.

Best of luck!