How do I bleed the brake lines?
Before you start
If your bike is more than two years old, or you have no idea when/if the brake fluid was changed, you might as well just change the fluid. The procedures are nearly the same. Do yourself a favor and read both articles. If the rubber lines are 4+ years old, it's time to change them, which you might as well do now and save yourself refilling/bleeding twice.
Brakes are a very important system on your bike! If you're not completely comfortable working on this system, take it to a mechanic. Your brakes are vitally important, and if they're not working exactly right it's very easy to get into an accident and possibly injure yourself or die. If you can't afford to take the bike to a mechanic, enlist a more mechanically-inclined friend to help out. This is not difficult work to do, but if you mess it up, you can kill yourself.
Keep all fluids except water away from brake pads. DO NOT spill any brake fluid on the brake disc or pads. If you do, use brake cleaner to clean the disc, and replace the pads.
Keep in mind that brake fluid is corrosive to paint and some metals. If it gets on any part of the bike other than the inside of the braking system, clean it off as quickly as you can.
It is vitally important to keep the brake's hydraulic system clean and free of dirt, water, or any other impurities. Any foreign material in the braking system can result in the brakes failing to function either in normal operation or in extreme operation (like when you're braking hard and really need your brakes to work). Be as clean with the brakes as possible. It's OK if the outside of the braking system (like the hoses, reservoir, calipers, etc.) gets dirty; this is normal and safe. It's the inside you have to be concerned with.
Brake fluid is also hygroscopic, which means that it readily absorbs water. So, if it's exposed to water in any form (including moisture in the air), it'll absorb it. This lowers the boiling point of the fluid. As you brake, particularly in emergencies, your brakes generate a tremendous amount of heat, up to 300-400° F, which can cause "wet" brake fluid to boil. When it boils, pockets of vapor are generated, which act just like air in the lines, dramatically reducing braking performance right when you need it most. This is why changing the fluid every two years is important.
Bleeding the brake lines is something which only needs to be done if the brakes feel spongy or weak. This can be caused by air in the lines, which compresses, absorbing energy but not transferring it to the brake pads. Weak brake feel can also be caused, to some extent, by warped brake rotors or contaminated pads. Always make sure you keep oil, soap, brake fluid or any other lubricant away from the brake pads and rotors. If the brake parts do get anything on them, clean it off with brake cleaner. Pads may not be recoverable if they get much oil on them. Replace the pads if you're uncertain.
Bleeding brakes will help purge air from the system. If you're having to bleed the brakes in between fluid changes, there's probably a leak in your system which needs to be addressed. Look for dark or oily spots along the system, and replace any parts you suspect.
Tools and Supplies
In order to bleed the brake lines, you'll need the following tools and supplies:
The procedure outlined here applies equally to the front or rear brake. It's mostly phrased as if working on the front brake, but you can replace "lever" with "pedal" in any of these instructions. The key differences are that the rear reservoir won't "spit" much or at all when you jam down on the pedal, and it's easier to get bubbles out, since the line is mostly horizontal. Note that the rear has its own fluid reservoir, down near the brake lever. Remove the right side panel for access.
Be aware that when you pull the brake lever, hydraulic fluid can shoot up out of the reservoir with a good bit of force. For this reason, keep the cover on the reservoir (front or rear) except for when you're pouring fluid into it. Remember that brake fluid will strip paint, so keep it cleaned up if any spills.
All you really need to bleed your brakes are a screwdriver for opening the reservoir, an open-end wrench for the bleed nut, a length of hose, and some catch container (a glass one, such as a Snapple bottle). Once the reservoir is cleaned of the old fluid and refilled, just squeeze the lever, open the bleed nut until the brake lever hits the grip, tighten the bleed nut and release the lever. Repeat as necessary. Motorcycles are so small that anyone can bleed them by hand.
More words version
First, arrange your catch container. Attach the tubing to the brake caliper bleed valve - it should have a rubber cap covering it. Remove that cap and push your tubing onto the nipple. Route the tubing into the catch container, and pour about an inch of brake fluid into the container. This will allow backwards flow of brake fluid into the system without sucking in air.
Next, clean off the brake reservoir cap carefully, to get rid of any dirt. Take off the reservoir cap with the #2 Phillips screwdriver (or unscrew it if you're working on the rear brake). It's a good idea to put a rag under the reservoir in case of any spills, particularly with the front brake. If you want to be extra careful, remove the bodywork.
Lay the cap and rubber diaphragm aside in a clean location, but keep them handy. Empty the reservoir by sopping it out with a paper towel. Then refill the reservoir with fresh fluid. Be careful not to spill. Give the brake lever a very slow and gentle experimental squeeze. Note what happens in the reservoir. If nothing happens, try just a tiny bit harder and faster. Keep going until you see the brake fluid shooting up. For this reason, it's probably best to put the rubber diaphragm back on the reservoir, but you can do it open if you want (and are willing to clean up the mess).
Pump the brake lever sharply a number of times. You're trying to dislodge any air bubbles, so they're not "stuck" to the system. It may also be helpful to tap on junctions at the reservoir or on the caliper with a small wood or plastic mallet. A medium sized screwdriver handle (not the blade!) also makes a good light mallet for this. Make sure you're just tapping; the goal is to dislodge bubbles, not bend, dent or break anything.
Now, grab your wrench and prepare to open the bleed valve on the caliper. Before you do, put pressure on the brake lever with your left hand. Once there's pressure in the system, open the bleeder valve. You're going to close it a second later, just before the brake lever hits the bar. The goal is to only have the valve open when there's pressure actively in the system. As soon as the brake lever stops or begins its return stroke, it will suck in brake fluid (and probably air) from the bleed valve if it's open.
Repeat this operation a number of times.
Check often to make sure the brake fluid reservoir isn't getting empty. If it does get empty, you'll suck air into the system, negating all the effort you just put in. You will probably see an air bubble or two come out of the valve. Keep going until the brake control feels firm and solid. There's a certain amount of flex inherent in the stock brake lines, so the system will never be truly rock-hard until you replace the stock lines with stainless steel braided lines.
The brake control should not sink at all and should come to a stopping point and stay there, no matter how long you hold it.
Once the brake feels good, make sure the bleed valve is tight, but it doesn't need to be muscle-man tight. Torque for the bleeder valve is 69 in-lbs. Too much torque and you could damage the brake caliper, possibly causing a leak and necessitating replacement. If you have a service manual, check the torque value listed. Top up the brake fluid reservoir if it's not already at the Max mark. Put the diaphragm and cap back on the reservoir and screw it down. Clean up any spilled brake fluid, and you're done.
If you can't get all the air out
If all else has failed, and you still can't get the brake lever to be firm, air may have collected at the top banjo bolt. You have two options:
Speed Bleeder Method
This method is nearly identical to the regular one. The only difference is that with Speed Bleeders you don't need to work on opening and closing the bleed valve as you squeeze the brake lever. You just keep squeezing the brake lever until all the air is out. Keep a close eye on the reservoir, as it's very easy to accidentally empty it with Speed Bleeders.
When you open the bleed valves, they only need to be opened a half turn or so, just enough to let the pressure escape. As you pump, you should see a bubble or two escape, although this will improve things even if you don't see any bubbles go by.
This discussion on Speed Bleeders may be useful.
Once you have the brake system feeling better, you're nearly done. Make sure everything is filled up to the full mark and tightened back down. Check with your local laws regarding how to dispose of brake fluid, both new and used. Don't just throw it in the garbage.
Your opened bottle of new brake fluid should now be considered contaminated (from water in the air). Only keep it if you want it around for emergencies. It's better than not having brakes, but it'll go bad faster. Always use a new bottle of brake fluid when doing scheduled brake maintenance.