This work aims to explain how firms behave and select their partners in the Tokyo Stock Exchange (TSE) production network (network of suppliers and customers). Based on the microscopic interactions between firms, we look at the mechanism behind the emergence of the topology of the TSE production network. The supplier-customer network of listed firms in Japan (3,189 firms with 20,369 links) is estimated by the so-called exponential random graph model (ERGM). For the estimation of such a large-scale network, a fixed-density Markov chain Monte Carlo sampling method, which considerably improves the convergence time of the MLE estimation, is used. Our implemented fixed-density ERGM (FD-ERGM) keeps the number of ties constant, which drastically reduces the number of allowed network states and avoids the problem of full or empty graphs. We investigate six estimation scenarios (including a Bernoulli model, stars model, economic model, and social circuit model) in order to understand the roles of different network motifs (endogenous attributes) and economic variables (exogenous attributes) in the emergence of the topology of the TSE production network. We find that the topology of the TSE production network is reproduced only when endogenous and exogenous attributes are included. However, K-triangles were found to be essential in explaining the basic community characteristics of the network, such as the clustering, while exogenous attributes are determinant in the emergence of economic-based connections. Finally, the estimation results (see Table 1 shows results of one model) show that almost all attributes are statistically significant. Firms choose their partners based on social characteristics such as mutuality and transitivity. Moreover, the selection process depends on different economic variables such as having the same major bank, the same sector of activity and the same geographic location.