Or they simply did it on purpose.
People seem to think Apple has no gain in leaking the next iPhone publicly, but fact is their "magic" has been fading since the days of the first iPhone launch. The iPad was generally viewed as nothing terribly innovative, just a product that people want but have already thought of. The announcement of iPhone OS 4 was all too underwhelming, with Apple playing an obvious game of catchup with a poor implementation multitasking and mobile ads. Apple is obviously getting desperate to keep control of the market, and they're doing it by force more and more, as shown by their recent lawsuit against competitor HTC.
Now, about the iPhone leak. Apple has tons to gain from it. They have been getting fairly mediocre press lately, and the future of the iPhone was uncertain because the last iPhone was just a performance upgrade. I'm not saying the upgrade wasn't significant, but it lacked the magic that is so often associated with Apple product announcements. Google's Android platform has been gaining a lot of traction too, especially with massive advertising campaigns by Verizon Wireless in the US.
The next iPhone isn't coming out until summer. Apple is scared that people will switch to an Android phone, so how to they prevent that from happening? They leak a production quality prototype and make sure they get all the free press they can get. The product may be genuinely good, but it was a move out of desperation. They had to stage it to look like they're still a secretive company.
Tech blog Gizmodo has claimed that there would be no point for Apple to leak it on purpose, seeing how much effort they've placed into keeping the device secret. Face the facts though: secrecy won't get people thinking about your product when there are very worthy competitors all over the place. (Sprint HTC Evo 4G? Google Nexus One?)
All that to say, Apple probably leaked the phone on purpose.