We present a mixed-integer nonlinear optimization model for computing the optimal expansion of an existing tree-shaped district heating network given a number of potential new consumers. To this end, we state a stationary and nonlinear model of all hydraulic and thermal effects in the pipeline network as well as nonlinear models for consumers and the network’s depot. For the former, we consider the Euler momentum and the thermal energy equation. The thermal aspects are especially challenging. Here, we develop a novel polynomial approximation that we use in the optimization model. The expansion decisions are modeled by binary variables for which we derive additional valid inequalities that greatly help to solve the highly challenging problem. Finally, we present a case study in which we identify three major aspects that strongly influence investment decisions: the estimated average power demand of potentially new consumers, the distance between the existing network and the new consumers, and thermal losses in the network.