Ash comes only from explosive volcanoes. The material rising in the pipe, or vent, of the volcano is a mixture of liquid and gas.
When the liquid gets close to the surface, the gas expands and makes the liquid into a foam. Then, as the foam reaches the surface, it bursts apart, flinging the tiny liquid drops into the air, where they cool and form solid rock ash.