With large-scale deployment of renewable resources, the power systems are evolving to a horizontal structure with multiple supplies and interoperable power exchange. Such evolution largely improves system reliability and resilience. The first and foremost step toward these benefits is renewable energy planning. Whereafter, owning these renewable generation resources, the power systems concern renewable energy operation. Motivated by these, this thesis focuses on controlling and optimizing the renewable energy planning and operation involving the uncertainty in smart grid systems. In the first part of the thesis, we study the optimal location planning of renewable distributed generation (RDG) units by taking into account the random uncertainties of renewable generation and load demand. In presence of the random uncertainties, location planning problem is naturally a two-stage stochastic mixed integer nonlinear programming problem, which is hard to solve efficiently. Instead of using traditional sampling methods or robust optimization methods, we propose a novel analytical approach to solve the problem efficiently and optimally. In particular, analytical expressions are derived for efficiently evaluating the performance of a candidate RDG-placement decision. In this way, the stochastic mixed integer nonlinear programming problem is equivalently transformed into a deterministic integer problem, which can be solved efficiently using off-the-shelf tools. In the second part of the thesis, we study the optimal sizing planning of RDG in distribution networks to minimize the long-term cost, including investment cost, maintenance cost, and operating cost. In particular, the operating cost itself is optimized by solving an optimal power flow (OPF) problem at each time t based on uncertain time-varying RDG output and load demand. As a result, the sizing planning problem is a bilevel stochastic programming problem, which is hard to solve. Instead of resorting to conventional metaheuristic algorithms, this chapter first proposes a novel data-driven approach based on the philosophy of online convex optimization to solve the problem with drastically lower complexity. As a key step to facilitate the algorithm, we derive a closed-form expression to iteratively update the sizing solution upon drawing each data sample. With sufficient data samples, the proposed algorithm guarantees to converge to the global optimal solution regardless of the underlying probabilistic distribution of RDG output and load demand. In the third part of the thesis, we propose a broker-based transactive energy (TE) framework in a networked microgrid system, where the broker facilitates energy transactions between microgrids, and in return makes profit by charging a commission. Based on OPF, the broker computes an optimal price that incentivizes the microgrids to dispatch their distributed energy resources in a way that maximizes their payoffs. Noticeably, the proposed optimal pricing mechanism serves the purpose of distributed coordination for the operation of microgrids and the power exchange between them. Moreover, to accelerate the distributed algorithm, we derive the closed form solution of the optimal operation for each microgrid with respect to different market prices, and an efficient updating rule of the transactive price with optimality guarantee.