Music publishing refers to the management and administration of agreements and methods for transferring the rights to musical works (i.e., recorded tracks, printed music, or scores) for commercial use, in other words, to earn money. A musician can publish their work themselves, but certain parts of the administrative process take a lot of work and can be fairly complicated to handle for an individual.
Publishing companies will sign an artist to a publishing deal which spells out the terms of how their music is placed into films, TV, or other media, how the agreements work, and how much of the revenue (money earned) they will take as their fee or commission when a work is licensed commercially. Publishers will often actively market music from their clients for placement, since this is how they earn their money.
Licensing refers to the specific contract and terms of how a track is used commercially, for how long, and where it can be used. Therefore, licensing is much more specific than publishing and refers only to a certain use or placement of a song as defined by an agreement, called a contract or a license. Payments to the copyright owner are called royalties, or sometimes called “rights” which means the same thing as payments.
To summarize, publishing is the management of the agreements, placements, and payments for a song, while licensing is the actual agreement allowing for the placement of an individual work. Publishing and licensing deals allow musicians, composers, and artists to earn passive income from their music.
To get a better idea, watch this video with a brief introduction to music licensing from delicatebeats.com: