http://theblogbyjavier.com/2014/03/03/learning-curves/
http://theblogbyjavier.com/tag/learning-curve/
The manufacturers also give steep discounts on the first few planes off the assembly line, as they are less likely to meet the promised specs, probably overweight, and more prone to teething issues. Consequently the most expensive ones to make get lower revenues too. But then the manufacturer expects to make it up in volume over time.
The 787 programme has all the above applying, but also was done differently. In the late 90s McDonnell Douglas was bought by Boeing. The inside joke is that McDonnell actually bought Boeing, using Boeing's own money. Some of the senior management at Boeing for commercial aircraft was also taken over by McDonnell people. McDonnell was well known for financial engineering, somewhat as a side effect of not having much money,
They decided that the 787 would be revolutionary on many fronts at the same time. That includes extensive use of composites, all electric architecture (current planes use a lot of hydraulics and bleed air), new engines, and advanced systems. They also farmed out much of the design and manufacturing work (far more than normal for previous airliner programmes).
In theory that meant spreading of the risk, and that Boeing would slap the planes together, collect the money and get rich. The optimism meant pricing them really cheap which led to a huge number of orders, as airlines couldn't say no to such a bargain and specs.
In practise Boeing hadn't discovered new magic, risks hurt everyone, individual manufacturers had problems, different partners had different priorities, things didn't run as cohesively as expected, Boeing had to spend lots of money rectifying issues including buying some suppliers, assembly was problematic and the list goes on.
The consequence is that the overall expenditures and initial far too low pricing, combined with the actual learning curve means they are unlikely to ever make an overall profit.