Suppose you control 51% of the network and want to do a double spend against a merchant requiring 6 blocks of confirmation. To do that, you make the spend and allow the chain to operate normally. While it is doing so, you work on your own chain. After the main chain achieves 6 blocks, you wait until you have more than the main chain, then publish your chain. Now, everyone switches over to your chain. In particular, the last 6 blocks (or more, if you had to wait longer to overtake the main chain) are all your's because you were the only one working on your chain during that time.
If someone else has a block in those last 6, it would mean that someone else (who I assume is an honest node) saw your block. At this point, your entire chain will be published and likely overtake the mainline (otherwise, the honest miner wouldn't have bothered with it). Now, it appears to the merchant that your transaction has not yet made it onto the chain, so you have to wait for another 6 blocks confirming the transaction.
The only way I see around this is if you can partition the network. However, not only is this difficult, if you can partition the network, then you no longer require 51% to do an attack. In fact, if you can assure that the target is on the smaller partition, you require 0 mining power to do the attack.
EDIT: Essentially, at 51% you can make a "rule" that all blocks must be yours.
If someone else has a block in those last 6, it would mean that someone else (who I assume is an honest node) saw your block. At this point, your entire chain will be published and likely overtake the mainline (otherwise, the honest miner wouldn't have bothered with it). Now, it appears to the merchant that your transaction has not yet made it onto the chain, so you have to wait for another 6 blocks confirming the transaction.
The only way I see around this is if you can partition the network. However, not only is this difficult, if you can partition the network, then you no longer require 51% to do an attack. In fact, if you can assure that the target is on the smaller partition, you require 0 mining power to do the attack.
EDIT: Essentially, at 51% you can make a "rule" that all blocks must be yours.