Massive stars, at least $sim$ 10 times more massive than the Sun, have two key properties that make them the main drivers of evolution of star clusters, galaxies, and the Universe as a whole. On the one hand, the outer layers of massive stars are so hot that they produce most of the ionizing ultraviolet radiation of galaxies; in fact, the first massive stars helped to re-ionize the Universe after its Dark Ages. Another important property of massive stars are the strong stellar winds and outflows they produce. This mass loss, and finally the explosion of a massive star as a supernova or a gamma-ray burst, provide a significant input of mechanical and radiative energy into the interstellar space. These two properties together make massive stars one of the most important cosmic engines: they trigger the star formation and enrich the interstellar medium with heavy elements, that ultimately leads to formation of Earth-like rocky planets and the development of complex life. The study of massive star winds is thus a truly multidisciplinary field and has a wide impact on different areas of astronomy. [...] This detailed review summarises the current knowledge on the theory and observations of winds from massive stars, as well as on observations and accretion processes in wind-fed high mass X-ray binaries. The aim is to combine in the near future all available theoretical diagnostics and observational measurements to achieve a unified picture of massive star winds in isolated objects and in binary systems.