A method of operating a wind turbine using a controller, wherein the controller is configured to activate or deactivate each of two or more distinct control features of the wind turbine, each control feature changing the operating characteristic of the wind turbine and having an impact on at least one of lifetime and energy production of the wind turbine, wherein the method comprises: determining a type of optimization parameter and an optimization target for the optimization parameter, wherein the optimization parameter is related to at least one of (a) lifetime of the wind turbine, (b) energy production of the wind turbine, and (c) power demand satisfaction for a power demand from a power grid to which the wind turbine is connected; performing one or more optimization steps, wherein each optimization step is performed for a different combination of activation states of the two or more control features, wherein each optimization step includes: selecting a combination of activation states of said two or more control features; estimating the optimization parameter, said estimating including at least the estimation of the remaining lifetime if the optimization parameter is related to the lifetime of the wind turbine, and said estimating including at least the estimation of the energy production of the wind turbine if the optimization parameter is related to the energy production of the wind turbine or to the power demand satisfaction, wherein the estimating considers the impact of the control features activated in the optimization step; based on the estimated optimization parameter, determining if a further optimization step is to be performed; wherein the method further comprises: based on said one or more optimization steps, determining the combination of activation states of the two or more control features for which the estimated optimization parameter meets the optimization target as an optimal combination of activation states, the optimal combination of activation states being automatically determined by the controller, and activating the control features of the wind turbine in accordance with the determined optimal combination of activation states and operating the wind turbine with the activated control features. determining a type of optimization parameter and an optimization target for the optimization parameter, wherein the optimization parameter is related to at least one of (a) lifetime of the wind turbine, (b) energy production of the wind turbine, and (c) power demand satisfaction for a power demand from a power grid to which the wind turbine is connected; performing one or more optimization steps, wherein each optimization step is performed for a different combination of activation states of the two or more control features, wherein each optimization step includes: selecting a combination of activation states of said two or more control features; estimating the optimization parameter, said estimating including at least the estimation of the remaining lifetime if the optimization parameter is related to the lifetime of the wind turbine, and said estimating including at least the estimation of the energy production of the wind turbine if the optimization parameter is related to the energy production of the wind turbine or to the power demand satisfaction, wherein the estimating considers the impact of the control features activated in the optimization step; based on the estimated optimization parameter, determining if a further optimization step is to be performed; selecting a combination of activation states of said two or more control features; estimating the optimization parameter, said estimating including at least the estimation of the remaining lifetime if the optimization parameter is related to the lifetime of the wind turbine, and said estimating including at least the estimation of the energy production of the wind turbine if the optimization parameter is related to the energy production of the wind turbine or to the power demand satisfaction, wherein the estimating considers the impact of the control features activated in the optimization step; based on the estimated optimization parameter, determining if a further optimization step is to be performed; based on said one or more optimization steps, determining the combination of activation states of the two or more control features for which the estimated optimization parameter meets the optimization target as an optimal combination of activation states, the optimal combination of activation states being automatically determined by the controller, and activating the control features of the wind turbine in accordance with the determined optimal combination of activation states and operating the wind turbine with the activated control features.