How does an aeroplane maintain balance during maneuvers? I understand the principle behind flight, how the lift is generated etc. What I don't understand is when there are maneuvers made where the plane flies such that the wings are in vertical plane, how does the plane not lose its balance? How are the forces acting to keep it steady and from falling?
Same doubt about helicopters doing maneuvers.
Fun question: Did an engineer or a scientist figure this on paper or did a maverick pilot got them thinking and sent them back to analysis? 
 A: Well, there are always four forces acting on the plane. The work of ailerons, rudder and tail-plane (or the stabilizers) is to balance these forces, so that the aircraft can orientate freely in the pitch, yaw and roll axes. Like Jerry told, the thrust of the aircraft determines how it's stable during the pitch (up or down). But, there's always a constraint on the altitude of a plane as it climbs on the pitch axis. This can be noted in many aircraft simulators.
A low thrust (also a heavy) aircraft like the Boeing 747 can't climb a high altitude like the fighter jets which have a high thrust (light).
You can have a look at the Wiki article on the 3 axes...
A: Why does an aircraft need to be in balance?
When you walk, you are not in balance. You are always falling in one direction or the other, and you put your foot out to stop falling one way, and then start falling a different way.
If something stops you from placing your foot where you want, you fall over.
When you ride a bicycle, are you balancing?
No. You start falling one way, correct for it, and start falling a different way.
You are always making corrections, even if they are very small.
If the handlebars are suddenly locked in the straight-ahead direction, you will quickly fall over, proving that you were not balanced.
An aircraft just responds to the sum of the force vectors acting on it, and those forces are controlled by the pilot.
When a pilot turns so the wings are vertical, of course the plane is out of balance.
She is doing it in order to make a high-G turn or to turn downward.
She is planning her next move to end that maneuver and begin another.
Freeze the controls, and you quickly have a crash.
Here's Patty Wagstaff doing aerobatics.
A: Actually planes are designed so that all the forces acting on it keeps it in balance so when you make a maneuvers you actually disturb the balance of the plane but in a controlled manner so when you do this still the primary forces acting on it try to bring it the lowest energy configuration i.e. is in which it experience least forces that's how it remains in balance

so as you see in the image the middle arrow shows the main flow of the air after striking from the flap so the force is acting in just opposite direction to the flow of air. Now as you know you can resolve  a vector into it's component so here the we will take the flow of air as a vector and resolve it in two direction's. So now you can see it have two component one horizontal and one vertical. So the flow of air in horizontal direction is responsible for turning the plane and  the vertical component of air which is going in downward direction will create a force in upward direction and that is the part which is responsible for the lift of the plane even when it is doing a  maneuvers.
A: To understand the complete stability question, let us first pay attention to the more particular question you asked:

the plane flies such that the wings are in vertical plane, how does the plane not lose its balance? How are the forces acting to keep it steady and from falling?

When the aircraft attitude is in this state, note that the axes have rotated and the control surfaces behave accordingly. The thrust and a rudder correction (to provide effective "lift" now) keeps it going at a constant altitude. Whereas, the wing keeps generating lift continuously so that the aircraft keeps changing is "heading" (direction); if not corrected by the elevators. (note that our axes have changed, so that the wing is now causing a "yaw" movement and the rudder, "lift", in global coordinate axes. I refer you to @Crazy Buddy's link:http://en.wikipedia.org/wiki/Aircraft_principal_axes)
So to answer your question: Maneuvering in any way, requires a corrective effort to counter the resulting motions due the fact that the lift generated by the wing is no more "buoying" the craft, but destabilizing it. That is exactly why pilots in the world-war era had a lotta things on their mind while flying (in our example; when they rolled, they had to correct the rudders AND elevators). These days, all of this is taken care by the computers (called 'fly-by-wire' tech).
Another interesting destabilizing phenomenon is the gyroscopic couple. Look into it if you are interested.
