We consider shape optimization problems, where the state is governed by elliptic partial differential equations. Using a regularization technique, unknown shapes are encoded via shape functions, turning the shape optimization into optimal control problems for the unknown functions. The method is studied for elliptic PDEs to be solved in an unknown region (to be optimized), where the regularization technique together with a penalty method extends the PDE to a larger fixed domain. Additionally, the method is studied for the optimal layout problem, where the unknown regions determine the coefficients of the state equation. In both cases, the existence of optimal shapes is established for the regularized and for the original problem, with conve...