The Scarecrow's Song is a customizable eight-note tune played on the ocarina in Ocarina of Time and Majora's Mask. With it, Link can summon Pierre.
Ocarina of Time
If Link speaks with Bonooru in Lake Hylia as a child, he will boast that he can remember any song. Link can then play whatever what he wants the Scarecrow's Song to sound like, and Bonooru will keep it memorized. It he wants to change it, all he needs to do is take out his ocarina again and play a new song.
Once Link goes seven years into the future using the Master Sword, he can return to Lake Hylia to talk to Bonooru again. If Link can play the same song from before, Bonooru will praise him and mention that Pierre is traveling around. He explains that he can play that song to summon Pierre.
Pierre will only appear in certain places, indicated by when Navi turns green. Link can use his Hookshot or Longshot to reach him, which can help him get to high up places or secret areas.
In Majora's Mask, Link must play the Scarecrow's Song for the "Stylin' Scarecrow" found in the Astral Observatory and Trading Post. He will promise to appear if the song is played. Similar to in Ocarina of Time, Link can use the Hookshot to get to this Scarecrow to find secrets. However, if Link plays the Song of Time, he will have to return to the Scarecrow and speak with him once more or the song will have no effect.