Networks are ubiquitous. We are all part of numerous social networks: at home in our family, at work with our colleagues and many others. Moreover, every day each of us relies on a variety of technological networks by using mobile phone, the WWW, public transport, etc. Any system where entities interact with each other is a network. Understanding the basic functional principles and the factors governing the evolution of the networks around us is a task of immense importance. Then, this will allow us to interact more efficiently within social networks and will open a new horizon for optimization of many existing technological systems. The main contribution of this work is to reveal the interplay between dynamic function and local structures, also called network motifs, in complex networks. Then, to shift that knowledge on dynamic self-organizing human-made networks and to deploy motif based optimization of P2P overlays as well as to present a novel approach for resilient P2P live-streaming. It also engages a local decision rule to detect communication bottlenecks in distributed environments and shows that random graphs are a suitable basis for a novel P2P overlay.