Mostly mechanically. We turn mechanical energy into electrical energy in machines called generators.
Electricity and magnetism are two sides of the same thing. Moving electrons create magnetic fields. Moving magnetic fields cause electrons to move. In a generator, a magnetic field is made to move near copper wires. The electrons in the wires begin to move, and the moving electrons are what we call electricity.
Moving electrons can heat up wires as they move through them. Electric stoves and incandescent lights work by heating up wires this way. Since moving electrons create magnetic fields, and magnets can attract one another, we can make electric motors to power our gadgets around the house.
The electricity that comes out of the plug in your house is made by a generator, but there are other ways to make electricity. We can make it directly from heat, in a simple device called a thermocouple. Twist two different kinds of wire together (like copper wire and iron wire), and when you get the twisted part hot, it makes electrons move.
We can make electricity from light using solar cells. We can make electricity from pressure by using a piezoelectric ceramic such as those in electric lighters. We can make electricity by moving electrons on an insulator past some sharp wires in a Van de Graaff generator. And we can make electricity chemically by building a battery.