In this paper, we investigate the formation of peer-to-peer (P2P) networks with rational participating agents (active peers). In the absence of a central planner, peers choose their own utility-maximizing strategies for coalition and peer formation. P2P networks evolve dynamically through the activities of interactions among individual nodes and group units. We propose a framework for multilevel formation dynamics, including an individual level (content sharing decision and group selection) and a group level (membership admission). The respective utilities of the individual node and the collective player are formulated as functions of operational performance metrics such as expected content availability, search delay, transmission delay, and download delay. We study the impacts of various system parameters on the emergence of self-organized P2P network configuration features such as free-riding level and group size. Furthermore, we investigate the stability and efficiency of P2P networks and propose internal transfer mechanisms that force stable networks to become efficient.