We can get electricity from hydrocarbons, chemical reactions, magnetism, nuclear reaction, water, sun and air.
Coal, oil and natural gas are the unclean source of electricity, hydrocarbons are the most used method to generate electricity and the cheapest. But hydrocarbons are the main source of global warming and pollution.
Chemical reactions is the source of electricity we see in batteries. The idea is transferring the chemical energy to electrial energy. The chemical energy can also be produced by the galvanic cell.
Electricity generator depends on magnetism in order to produce electricity. The magnetism power is produced when rotating a magnet in closed loops.
Nuclear energy is another source of producing electricity, by cutting the bonds in some materials especially Uranium a huge amount of power is released. But due to the great dangers that can occur it is not used in wide scales.
Kinetic energy is formed due water moves as flows downstream, falls, tides and waves. The energy from the water moving can be transferred to electricity using turbines.
Using Sun in producing electricity is a clean method also a renewable , solar energy can be transferred to electricity using photovoltaics and semiconductors. Mirrors can
be used as a concentrator factor.
Air is another clean and renewable source for producing electricity, using windmills has proven to be successful several places worldwide. Windmills farms are now put in the unused spaces including seas and oceans. But still it is not a very popular source of generating electricity due to the inability of controlling the direction of the wind.