Publishing rights are essentially the rights to get a song played on radio, movies, tv, performances, etc. and earn money off of them. The income generated from publishing rights is automatically split into two halves. One half is called the "Writer's Share" while the other is the "Publisher's Share".
Both halves of publishing rights are granted to the author(s) of a song from the moment it is written. Though when signed to a publishing deal, the author(s) generally give up half or all of their "Publisher's Share" in exchange for a cash advance and/or a publishing company to push the song to get played so that everyone earns money.
When there are artists, producers, and writers involved in the making of a song, they typically but not always, evenly share ownership in the "Writer's Share" of the publishing rights. The main author (the artist), typically but not always, will have full ownership in the "Publisher's Share" unless signed to a publishing deal.
When selling instrumentals, it is the producer's responsibility to specify what their terms of publishing rights are and how they would like to split ownership, if at all, of the "Writer's Share", if the song gets published by the artist purchasing the instrumental.