Underwriters represent the group of representatives from an investment bank whose main responsibility is to complete the necessary procedures to raise investment capital for a company issuing securities. Underwriters do not necessarily make guarantees concerning selling an initial public offering (IPO). However, that depends on the type of underwriting that is agreed upon with the stock's issuer. Each type of underwriting varies in the amount of risk the underwriter takes on and how the underwriter is compensated. The two most common types of underwriting are bought deals and best effort deals.
In a bought deal, the underwriter purchases a company's entire IPO issue and resells it to the investing public. The amount of compensation the underwriter makes represents the spread between the price for which the underwriter acquired the stock from the issuer (usually a discounted price) and the price the for which underwriter sells the stock to the public. In this case, the underwriter bears the entire risk of selling the stock issue, and it would be in his or her best interest to sell the entire new issue, because any unsold shares then continue to be held by the underwriter.
In a best effort deal, the underwriter does not necessarily purchase any of the IPO issue, and only makes a guarantee to the company issuing the stock that it will use its "best efforts" to sell the issue to the investing public at the best price possible. Unlike a bought deal, there is no consequence for the underwriter if the entire issue is not sold - it is the issuing company that is stuck with any unsold shares. Because there is less risk involved, the underwriter's gains are limited even if the issue does sell well, because in the best effort situation, the underwriter is compensated with a flat fee.
To learn more about IPOs, see IPO Basics Tutorial and The Murky Waters Of The IPO Market.