Before I answer this question, remember that Mohamed (PBUH) was a human, he wasn’t an angel nor a demiGod. But simply, a person like you and me.
So his life included everything a human life might go through. Love, war, financial dealings with others, and the list goes on.
And as was mentioned in the Quran {He does not speak from [his own] desires. It is not but a revelation revealed (from Allah)}
(Chapter An-Najm: 3,4)
That’s why, after the Quran, the Sunnah (traditions and practices) of the Prophet Muhammad (PBUH) is the second most important source of Islamic knowledge. The Sunnah is a comprehensive term that, as the scholars say, includes the statements, actions, characteristics and moral ethics of the Prophet (PBUH). Though it emanated from the Prophet PBUH, it was inspired directly from Allah, and thus is another form of divine revelation, as Allah says in the Quran:
{He does not speak from [his own] desires. It is not but a revelation revealed (from Allah)}
(Chapter An-Najm: 3,4)