Baby birds, or fledglings, learn to fly by trial and error and with encouragement from mother birds. Fledglings usually jump out of their nests before they know how to fly.
Some mother birds encourage fledglings to fly during feeding time. The mother bird stands farther and farther away from the nest each time she comes to feed the babies. The fledglings soon understand they must move away from the nest to be fed. Eventually, the fledglings step so far away from the nest they fall to the ground. Typically fledglings spread their wings as they fall, learning that they can ease the descent. They even start flapping their wings, which breaks the fall. Eventually, they associate this behavior with getting fed and not falling, so they have learned to fly. In some cases, fledglings don't jump, forcing mother birds to push them out.
Some fledglings learn to fly from the ground, especially if there's no easy way for them to get back to the nest. In this case, they run around on the ground while hopping and spreading their wings. Eventually, they're able to hop onto low branches then fly. Mother birds still feed the fledglings during this stage.
In general, birds fly because their wings are shaped like an airfoil, causing the air to flow faster above the wing. This lowers the pressure, which draws the bird upward.