The term "bleeding the brakes" refers to the process in which a small valve is opened at the caliper (or wheel cylinder) to allow controlled amounts of brake fluid to escape the system. (When you think about it, "bleeding" may appear to be a somewhat graphic term, but it aptly describes the release a vital fluid.)
We bleed the brakes to release air that sometimes becomes trapped within the lines. Technically, "air" only enters the lines if there is a compromise of the system's sealing (as when flex lines are removed or replaced), because when fluid boils, it will instead create "fluid vapor." Vapor in the brake fluid, like air, will create an efficiency loss in the braking system. However, for the sake of simplicity we use the term "air" throughout this article to describe both air and fluid vapor.
When air (or vapor) becomes present within the lines, it creates inefficiencies within the system because, unlike liquid, air can be compressed. So when enough air fills the lines, input at the pedal merely causes the air to compress instead of creating pressure at the brake corners. In other words, when air is present within the system, the efficiency and effectiveness of the braking system is reduced. Usually, a small amount of air within the brake system will contribute to a "mushy" or "soft" pedal (since less energy is required to compress the air than is required to move fluid throughout the brake lines.) If enough air enters the brake system, it can result in complete brake failure.
So how does air enter the lines in the first place? Sometimes, it can be the result of a service procedure or an upgrade – such as replacing the stock flex lines with stainless steel braided lines. But often it is the result of high temperatures that cause brake fluid components to boil, thus releasing gasses from the boiling fluid into the brake hydraulic system.