The advantage of a flat fee is the attorney fees are quoted before starting the legal project. That is, the client knows the attorney fees before deciding to start the work and can budget appropriately. Usually, flat fees are provided to create patent, copyright, and trademark rights. Also, flat fees are used for most form agreements and software licenses. To quote a flat fee, the client and I first discuss the specific circumstances and review documentation to determine the scope.
The advantage of a contingent fee is that legal fees are only paid if a desired legal result is achieved. For example, when negotiating a license agreement, attorney fees would be paid if the deal closes (sort of like paying real estate agent's percentage commission). Before accepting a case on a contingent fee, I meet with the client and review thoroughly.
Finally, the client always has the option of hourly billing, which may be used for open-ended legal work when the effort can not be predicted. Usually, litigation and enforcement of intellectual property is billable hourly.