There are a lot of places in which cocoons can be found. They can be found attached to branches or twigs, under the loose bark that is on dead trees, hidden among fallen leaves, located under stones and rotting logs, on the bottom edges of window sills or inside of buildings like garages and sheds. As long as these places are cool and moist, it is possible that you will find a cocoon there.
You never know what type of insect will come out of these cocoons. That is because there are so many different insects that use cocoons. They include moths, ants, fleas, bees and butterflies. It is inside of these cocoons that these insects go from pupa to adult.
Cocoons are made of silk that is spun from 2 glands inside of an insect that are filled with a thick glue-like material. The insect is able to press this material out in 2 slender threads that stick together as they emerge, which then harden in the air.
There are various ways in which an insect can emerge from its cocoon as an adult. There are some who have mouthparts that are able to help them bite their way out of their cocoon. Other insects have to use “spit” to soften 1 of the ends of the cocoon so that they can then push their way through the fibers. Two insects actually build in an "escape hatch" for themselves from the cocoon that they have built around them. These are the Cecropia and the Promethea, which have a cone/valve type of an arrangement built at 1 of the ends of their cocoons.
Regardless of how these insects build cocoons around themselves, or find ways to escape from them later, watching these things happen is actually quite miraculous.