My kids and I raise Monarch butterflies every year, and as an adjunct also raise any other caterpillars we come across including Black Swallowtails.
In my experience, small percentage do die. Typically, they have bacterial disease such as Bt which is naturally occurring, but they may have been infected by garden or agricultural application. For this reason, I only use it as a last resort in my own garden. Wind or insect, contaminated pollen transference are other sources of infection. The caterpillars can die at any stage but most often at very young instars -- they just stop feeding, turn brown and turn into mush.
(Note that GM Bt corn pollen has been shown to kill Monarch caterpillars ingesting wind-blown pollen covered milkweed)
If an older -- at least 3rd instar -- caterpillar (up to and including a new chrysalis) hangs limp and dies, be sure to examine the remains for trailing mucus strand(s) and inspect container closely for maggot(s) or a brown pupae of Tachnid fly parasite.
Monarch butterflies are also sometimes infected with an organism commonly abbreviated as OE. The adults carry the spores on their wings and pass the infection to their offspring. OE infected butterflies can only be discovered by examining the wing scales under the microscope, and carriers wow no sign of disease. But the caterpillars often have black splotches on them and infected chrysalis show black shadows inside. -- I don't know if Black Swallowtails are also subject to infection.
Then, of course, some caterpillars are collected from plants that have been chemically sprayed or have been caught in herbicidal or insecticidal drift. Often the chemicals are neurotoxins and they deteriorate quickly.
Despite these heartbreaks, I think it's incredibly rewarding to raise the healthy caterpillars and watch them metamorphose and eclose as butterflies, don't you?