Demiplanes are generally small, finite planes connected to either the Astral or Ethereal Planes. They are created when reality is sufficiently warped that small pieces of its substrate fragment and fuse together, thereby creating a stable dimension.
Ethereal demiplanes spawn as a result of the tidal forces of the Positive and Negative Energy Planes, which also generate the ethereal mists. This mist sometimes forms localized concentrations or eddies which give birth to ethereal demiplanes.
An astral demiplane is formed as a combined result of turbulence within the River of Souls, proximity to the Maelstrom, and the distant action of elemental fire. These three forces create powerful astral storms shaped like a hurricane that have a calm eye at their center. It is within these stable eyes that astral demiplanes are occasionally born.
Lastly, demiplanes can be formed by the workings of powerful magic, be it from an artifact, a powerful mortal spellcaster, or the will of a god. All that is required is for reality to be bent and twisted to the breaking point.