Over a long period of exploration, the successful observation of quantized version of anomalous Hall effect (AHE) in thin film of magnetically-doped topological insulator completed a quantum Hall trio---quantum Hall effect (QHE), quantum spin Hall effect (QSHE), and quantum anomalous Hall effect (QAHE). On the theoretical front, it was understood that intrinsic AHE is related to Berry curvature and U(1) gauge field in momentum space. This understanding established connection between the QAHE and the topological properties of electronic structures characterized by the Chern number. With the time reversal symmetry broken by magnetization, a QAHE system carries dissipationless charge current at edges, similar to the QHE where an external magnetic field is necessary. The QAHE and corresponding Chern insulators are also closely related to other topological electronic states, such as topological insulators and topological semimetals, which have been extensively studied recently and have been known to exist in various compounds. First-principles electronic structure calculations play important roles not only for the understanding of fundamental physics in this field, but also towards the prediction and realization of realistic compounds. In this article, a theoretical review on the Berry phase mechanism and related topological electronic states in terms of various topological invariants will be given with focus on the QAHE and Chern insulators. We will introduce the Wilson loop method and the band inversion mechanism for the selection and design of topological materials, and discuss the predictive power of first-principles calculations. Finally, remaining issues, challenges and possible applications for future investigations in the field will be addressed.