“the rebuke of the wise.” This is a wonderful exhortation for both the person who needs advice and also to the wise. A wise person knows when and how to rebuke a person so that it does the most good (cp. Prov. 17:10). The person struggling with something should be thankful that wiser people are willing to help, even if by rebuke. Sadly, people in our modern culture tend to be very arrogant and unappreciative of instruction in any form, and due to that many wise people refrain from trying to instruct, rebuke, or correct those acting in ways that clearly are not in their best interest. Wise people should take courage from the potential good that they can do and take a risk in order to accomplish the greater good.
“the song of fools.” Besides the wider meaning of different songs that fools might sing when they are inspired or excited, typical “songs” in the biblical world were written and sung to praise someone or something, or in order to remember something (cp. Exod. 15:1, about escaping from Egypt; Num. 21:17, about getting water in the wilderness; Deut. 31:19, about the Israelites in the wilderness; Judg. 5:12, about Deborah’s victory over the enemy; 1 Sam. 1:18, extolling Saul and Jonathan; 2 Sam. 22:1, David’s song about his deliverance from king Saul; Job 30:9, that people sang about the misfortunes of Job). In that light and in this context, the “song of fools” would be a song extolling some undeserving person or event, or outright flattery. The point is that the rebuke of a wise man might sting for a moment but be very helpful in the end, and that is much better than the flattering song of a fool, which might make a person feel good for a moment but will hurt instead of help in the end.
It has been suggested that “song” in this context means “praise” (referenced by Tremper Longman in the New International Commentary on the Old Testament), but since songs very often were about praise and something fools would do, there is little reason not to see the standard meaning of “song” here.