Its the same as anything else, a custom development can meet your exact needs. The rarer the requirements the more likely that a custom solution will benefit you. For example almost nobody needs a custom word-processor as this is a common requirement and competition and volumes of sales has meant that there are good solutions. Someone else will probably have wanted and requested the most important features.
If you want something rarer, like a medical records system, then there will be fewer offers and more gaps, fewer customers mean that not all scenarios will be covered. At the extreme if you have a unique requirement there may be no package solutions and you will need a custom solution.
Like custom cars, there will always be people who have custom solutions because they like it, I once read about someone who souped up a Ford Cortina (Old British Ford) untill it was faster than a Ferrari, even though it ended up costing more than a Ferrari would have done.
A halfway house between off the shelf and custom software is a tailored package. Here you take a package that meets most requirements and modify it to fit your specific needs. This can be done by getting the company to produce it to tailor it or by taking an open-source application and doing it in-house. (Some commercial companies may let you modify their source yourself under license.)
I am an Enterprise Architect