As part of a national scientific network Pathways to Habitability the formation of planets and the delivery of water onto these planets is a key question as water is essential for the development of life. In the first part of the paper we summarize the state of the art of planet formation - which is still under debate in the astronomical community - before we show our results on this topic. The outcome of our numerical simulations depends a lot on the choice of the initial distribution of planetesimals and planetary embryos after gas disappeared in the protoplanetary disk. We also take into account that some of these planetesimals of sizes in the order of the mass of the Moon already contained water; the quantity depends on the distance from the Sun - close-by bodies are dry, but starting from a distance of about 2 AU they can contain substantial amounts of water. We assume that the gas giants and terrestrial planets are already formed when we check the collisions of the small bodies containing water (in the order of a few percent) with the terrestrial planets. We thus are able to give an estimate of the respective contribution to the actual water content (of some Earth-oceans) in the mantle, in the crust and on the surface of Earth. In the second part we discuss in more detail how the formation of larger bodies after a collision may happen as the outcome depends on parameters like collision velocity, impact angle, and the materials involved. We present results obtained by SPH (Smooth Particle Hydrodynamics) simulations. We briefly describe this method and show different scenarios with respect to the formed bodies, possible fragmentation and the water content before and after the collision. In an appendix we discuss detection methods for extrasolar planets (close to 2000 such objects have been discovered so far).