In the simplest sense, a stellar wind is a flow of neutral or charged gas that is ejected from the upper atmosphere of a star. In the case of the Sun, the average wind speed is between 200 and 300 km/s from quiet regions, but can can exceed 700 km/s in active regions. In cooler, low-mass stars like our Sun, the stellar wind is caused by the extremely high temperatures in the corona (upper atmosphere).
What produces the high temperatures in the corona is still an area of active research and is often termed the ‘coronal heating problem.’ The most prevalent theory involves magnetic flux tubes that extend vertically up into the corona (see the graphic below taken from Tu et al., 2005). The interior of a star is convectively unstable, and the convection in the photosphere of the star shakes the flux tubes transversely. The resulting perpendicular perturbations in the velocity and magnetic field propagate upwards as Alfvén waves. For those not familiar with Alfvén waves, consider a plucked wire. In such a wire, tension is the restoring force. In Alfvén waves, a form of ‘magnetic tension’ is the restoring force. Eventually, the energy from the Alfvén waves is dissipated and the corona is heated as a result. For more on coronal heating models, refer to Steven Cranmer’s notes from the 2007 NSO Solar Physics Summer School.
Over the course of their entire lifetime, stars like the Sun only lose about 1% of their mass via a stellar wind. In contrast, much more massive stars can eject many solar masses of material through winds (up to 50% of their initial mass). Stellar winds in these hot stars are driven directly by radiation pressure from photons escaping the star.