Producers are generally of two types: those who work for record companies and those who freelance.
The main goal of producers who work for record companies is to ensure they leave the studio with a quality recording that comes in at or under budget.
The producer may take a role in helping the artist choose material for the recording. This is more common when the artist is a solo act, as bands will usually have their material predetermined.
In the case of a solo artist, the producer will seek out and hire backup musicians. Studios may also have a stable of musicians from which the producer can choose.
In some cases, the producer will be the recording engineer. Mostly, though, the producer will either bring someone into the studio or choose an in-house engineer.
The producer serves as the artist's or band's extra set of ears. Many times, a producer will hear something that the musicians may have missed and will suggest an alternative way of recording a song or a segment of a song.