Like the foreman in any factory, the producer must know how everything works, why you use it, when to use it, and exactly what the final product should be like. This means an intimate knowledge of the music as well. Great producers hear the song finished in their heads from the first moment. They plan, craft and inspire the musicians to give their best, filling out the final mix to the last degree of the band's dreams. Producers are usually hired by the artist to make the demo that will be sent out to record companies or by the record company to make the record that will be sold.
Some record labels have producers on staff.
Most, though, are like myself, independent. This is a large grey area in the music world. If a producer already has hits, as described above, then the chance of being signed for the recordings you make is very good, and a deal like this would be worth it. However, if the producer is not already well-known, chances are quite slim that the recordings will be released. The label will usually want to sign the band, re-record everything with a producer of their choosing, and then they will own the new recordings.