In this cooperative arrangement; two airlines operate a combined flight instead of competing each other. The one which actually operates the aircraft is called operating carrier i.e British Airways (BA) and the other as Marketing Carrier i.e.American Airlines (AA). Marketing carrier actually blocks a small percentage of seats (i.e. 20%) of operating carrier as per agreed terms and conditions and sell those seats to their customers under their own brand name (AA). However, it is obliged to inform the passenger that he/she would be actually flying with another airline (BA). The two brands however usually match, because no one wants to lose its loyal passenger for having bad experience with the other airline.
Why do airlines need to enter into a code share arrangement? They do so because it commercially suits both the airlines, on a relatively thin route where achieving breakeven seat factor becomes a challenge for both of them. For operating carrier empty seats are perishable and therefore result in heavy losses. Hence it would be advantageous for it to cut the losses by selling these seats in bulk on a much cheaper rate to marketing carrier usually at cost. The marketing carrier, however, sells these seats with profit margin to its own customers. Unsold blocked seats are released back to operating carrier well in advance i.e. one week. This arrangement reduces competition. That is why code share arrangements require prior approval of Anti Trust organizations of the respective Governments.
Marketing carrier also gains on a number counts. It is able to prevent its loyal customers from switching over to another airline just because it does not serve the desired destination. The marketing carrier also makes a bit of profit without actually operating its own aircraft. It can claim to serve far more destinations without actually operating some of them. It also means that Marketing carrier has a plan to actually start operations as and when the desired level of demand builds up.
Code share arrangements are in fact quite complex because it raises the issue of liability i.e. compensation in case of baggage loss/damage etc.
Code share is good for airlines but not so good for the passengers. It suppresses competition and artificially increases price on the code shared route. In a crises situation like long delays or denied boarding and baggage loss cases etc, the passengers of marketing carrier may feel left out because the staff of operating carrier may be paying more attention to their own passengers