Narrated Ibn Abbas:
The prostration of Sad is not a compulsory one but I saw the Prophet prostrating while reciting it.
This is the ayah the Hadith is talking about:
قَالَ لَقَدْ ظَلَمَكَ بِسُؤَالِ نَعْجَتِكَ إِلَىٰ نِعَاجِهِ ۖ وَإِنَّ كَثِيرًا مِّنَ الْخُلَطَاءِ لَيَبْغِي بَعْضُهُمْ عَلَىٰ بَعْضٍ إِلَّا الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ وَقَلِيلٌ مَّا هُمْ ۗ وَظَنَّ دَاوُودُ أَنَّمَا فَتَنَّاهُ فَاسْتَغْفَرَ رَبَّهُ وَخَرَّ رَاكِعًا وَأَنَابَ ۩
“[Dawud (David)] said (immediately without listening to the opponent): “He has wronged you in demanding your ewe in addition to his ewes. And, verily, many partners oppress one another, except those who believe and do righteous good deeds, and they are few.” And Dawud (David) guessed that We have tried him and he sought Forgiveness of his Lord, and he fell down prostrate and turned (to Allah) in repentance.” [Saad: 24]
If you go through the ayaat where sajdah of tilawat is prescribed, you’ll notice that either there is a command from Allah to do sajdah in the words, or the enticement (targheeb) to do so. For example, in the ayah mentioned above, Allah talks about the humble nature of Dawud (AS) and how he fell into prostration to Allah upon realizing that he was being tested by Him. When a person is going through this ayah, he feels the inclination to do as Dawud (AS) did. Prophet (SAW) did it, and we do it too. :)