Decentralized generation, distributed energy storage systems and active participation of end-users in the lower level of the electrical infrastructure, intelligently managed to provide grid support, define the notion of Active Distribution Networks (ADNs). The presence of distributed generation in ADNs incurs severe impacts on planning and operational procedures and calls for intelligent control techniques. This thesis focuses on the compelling problem of optimal operation and control of ADNs, with particular reference to the design of real-time voltage control and lines congestion management algorithms. In the first part of the thesis, we adopt a centralized architecture for voltage control and lines congestion management in ADNs. The goal of the proposed controller is to schedule the active and reactive power injections of a set of controllable resources, in coordination with traditional resources, in order to achieve an optimal grid operation. The controller relies on a linearized approach that links control variables and controlled quantities using sensitivity coefficients. Once the proposed algorithm is validated, as a further step, we relax the assumption that the DNO has an accurate knowledge of the system model, i.e., a correct admittance matrix and we adapt the proposed control architecture to such a scenario. When the controllable resources are heterogeneous and numerous, control schemes that rely on two-way communication between the controllable entity and the DNO cannot scale in the number of network buses and controllable resources. In this direction, in the second part of this thesis, we propose the use of broadcast-based control schemes that rely on state estimation for the feedback channel. We propose a low-overhead broadcast-based control mechanism, called Grid Explicit Congestion Notification (GECN), intended for provision of grid ancillary services by a seamless control of large populations of distributed, heterogeneous energy resources. Two promising candidates in terms of controllable resources are energy storage systems and elastic loads. Therefore, we choose to validate GECN in the case of aggregations of thermostatically controlled loads, as well as of distributed electrochemical-based storage systems. In the last part of the thesis, we formulate the control problem of interest as a non-approximated AC optimal power flow problem (OPF). The AC-OPF problem is non-convex, thus difficult to solve efficiently. A recent approach that focuses on the branch-flow convexification of the problem is claimed to be exact for radial networks under specific assumptions. We show that this claim, does not hold, as it leads to an incorrect system model. Therefore, there is a need to develop algorithms for the solution of the non-approximated, inherently non-convex OPF problem. We propose an algorithm for the AC-OPF problem in radial networks that uses an augmented Lagrangian approach, relies on the method of multipliers and does not require convexity. We design a centralized algorithm that converges to a local minimum of the original problem. When controlling multiple dispersed energy resources, it is of interest to define also a distributed method. We investigate the alternating direction method of multipliers (ADMM) for the distributed solution of the OPF problem and we show cases for which it fails to converge. As a solution we present a distributed version of the proposed OPF algorithm that is based on a primal decomposition.