The lifetime of geothermal projects mainly depends on the thermal breakthrough (thermal breakthrough occurs when a cold water front reaches the producer). Currently, geothermal-energy production is marginally economical because of its uncertainties and risks associated with the subsurface such as lifetime, flow rate, temperature. Lifetime of a geothermal reservoir plays the most important role in the use of geothermal energy because it mainly determines whether or not geothermal-energy production is economically viable.Through optimization of the well positions from one or more geothermal doublets in a homogeneous or heterogeneous reservoir, the profitability of the project, which is largely dependent on the time of compositional breakthrough, temperature breakthrough and the rate of temperature decline, can be improved. This thesis studies optimization of the well positions such that the Net Present Value (NPV) of a project is maximized in a 2D geothermal reservoir for the selected heterogeneity structure. For this purpose an automated, gradient-based optimization method is used. The approach is based on the concept to surround the wells, whose locations have to be optimized, by so-called pseudo-wells. The reservoir simulations are performed using the Finite Element Method in the program COMSOL Multiphysics 4.2a. The major features of the simulation results are discussed in detail.The compositional front moves faster than the thermal front (the ratio of these two is the thermal retardation factor). Breakthrough of water with altered composition will therefore occur at an early stage in the doublet lifetime. Reservoir heterogeneities influence the time at which thermal and compositional breakthrough occur and also determine the rate at which temperature and composition decline after breakthrough. The temperature and compositional decline curves after breakthrough are generally steeper in a homogeneous reservoir than in a heterogeneous reservoir. Therefore, the thermal breakthrough does not necessarily mean the end of the lifetime of a doublet. It is also shown that the effect of heterogeneities on the thermal retardation factor is small.Three successful optimization sequences in two different reservoirs are described in this thesis. It is shown that, from an economical standpoint, is makes little sense to assume a doublet lifetime of more than 30 years. Furthermore, the effectiveness at which a geothermal doublet is able to deplete a reservoir (recovery factor) and profitability of a geothermal doublet are closely interlinked. However, a higher recovery factor does not necessarily mean that the doublet is more profitable and vice versa. There exists an optimum well spacing for doublets positioned in homogeneous reservoirs, such that additional gain of later breakthrough (when placing the production well further away from the injector) is negated by the loss in pressure support of the injection well. This optimum well spacing is found to be an important factor, influencing the profitability in homogeneous...