Energy is produced in squares with Solar Collectors, particularly those at high Altitudes.
Depending on the Energy Allocation which you have made on the Social Engineering screen, all the energy you produce is divided among three priorities: Economy, Labs, and Psych. Some of the energy a bsae produces may also be lost to Inefficiency.