When a bird flaps its wings down, this not only pushes the bird up and forward, but it also tries to pitch the bird upwards because of the off-center force. During the time that the wing is moving down, a bird will angle its tail down. This generates a balancing upward force on the tail, which keeps the bird level. Without this, the bird would stall. If a bird wants to dive, it angles its tail down without flapping, or more than normal while flapping.
Airliners do the same thing with the structures on the front of the wing used during landing.
If at the bottom of the dive the bird wants to angle back up into a climb, it will raise its tail. This forces the tail down, pitching the bird up again. Turns are even more interesting. If the bird wants to change yaw, it doesn't have a direct way to do that since it has no rudder. Instead, it will roll into a bank in the direction it wants the yaw to change, effectively turning pitch partially into yaw through angled flight.