Publication occurs when your song is first made available to the public on an unrestricted basis. That is, you (the copyright owner) authorized the distribution, and there are no explicit or implicit limitations for the disclosure of the work. For example, you post a link to a new song on your website, you offer your song at Bandcamp or iTunes, you license your song for an ad, or you sell LPs at a concert.
Limited publication. The distribution of copies of a work to a definitely selected group with a limited purpose and without the right of diffusion, reproduction, distribution, or sale is a limited publication (an exemption from the publication rule, above). So, for example, sending out a handful of demos to record labels with the restriction, "For evaluation, Not for distribution" or posting the song to an invitation-only website, limiting the listeners, and preventing downloads would not be considered a publication.
Copyright killer. Before March 1989, the issue of "publication" could be a copyright-killer. That's because copyright could be lost if a work was published without notice. Once Congress dumped this draconian penalty, the question of whether a work was published became less of a life-and-death affair (though it is still important in disputes over fair use, duration, infringement, registration, and other matters).