Mortgage brokers deal with multiple lenders and can shop for the best terms available on any given day to match you with the best lender for your needs. They can find lenders who specialize in various market niches, such as loans to applicants with poor credit ratings, loans to borrowers who do not intend to occupy the property, loans with minimal or no down payment, and so on.
The broker takes your application and usually processes the loan, which involves putting together the complete packet of your information. The lender "underwrites" the loan to decide whether you are an acceptable risk, and they fund the loan.