Prophet Muhammad kept the attack on Mecca a closely guarded secret. However Hatib ibn Abi Balta'ah sent a letter to the Quraysh warning them of the attack. The Prophet was informed of this by revelation and he sent Ali and Zubayr to retrieve it.
The Muslim army eventually marched to Mecca, where they were instructed to spread out and display their numbers. Under the cover of night, Abu Sufyan and two other senior leaders of Quraysh were brought to the Prophet to surrender and were granted amnesty.
Lecture notes available at http://www.why-quran.org/?p=678.
Subscribe at http://www.why-quran.org/subscribe to watch the lectures live and participate in the Q&A at the end of each class.
Video recording of this lecture + Q&A available on YouTube at https://www.youtube.com/watch?v=CBYrR05Xgug&list=PLpkB0iwLgfTat-Pgh4W3WFmupPamiC9UT.