What are the ways of generating electricity?

Electricity can be generated by

Chemical means (as in a battery)

Mechanically by stressing a crystal (piezoelectricity)

By rubbing dry objects together (static electricity and lightening)

By using the energy of light directly (photovoltaic - solar cells)

By moving a magnetic field though a coil of conducting wire (or a coil of conducting wire though a magnetic field) (a dynamo)