Though perhaps other power sources can be used, the main sources of electrical power for robots are batteries and photovoltaic cells. These can be used separately or together (for practical applications, most solar-powered robots will need a battery backup).
Photo voltaic cell
Photo Voltaic Cells
solar cells are well known for their use as power sources for satelites, enviromentalist green energy campaigns and pocket calculators. In robotics solar cells are used mainly in BEAM robots. Commonly these consist of a solar cell which charges a capacitor and a small circuit which allows the capacitor to be charged up to a set voltage level and then be discharged through the motor(s) making it move.
For a larger robot solar cells can be used to charge its batteries. Such robots have to be designed around energy efficiency as they have little energy to spare.
Batteries are an essential component of the majority of robot designs. Many types of batteries can be used. Batteries can be grouped by whether or not they are rechargeable.
Batteries that are not rechargeable usually deliver more power for their size, and are thus desirable for certain applications. Various types of alkaline and lithium batteries can be used. Alkaline batteries are much cheaper and sufficient for most uses, but lithium batteries offer better performance and a longer shelf life.
Common rechargeable batteries include lead acid, nickel-cadmium (NiCd)and the newer nickel metal-hydride (Ni-MH). NiCd & Ni-MH batteries come in common sizes such as AA, but deliver a smaller voltage than alkaline batteries (1.2V instead of 1.5V). They also can be found in battery packs with specialized power connectors. These are commonly called race packs and are used in the more expensive RC race cars. They will last for some time if used properly. Ni-MH batteries are currently more expensive than NiCd, but are less affected by memory effect.
Lead acid batteries are relatively cheap and carry quite a lot of power, although they are quite heavy and can be damaged when they are discharged below a certain voltage. These batteries are commonly used as backup power supply in alarm systems and UPS.
An extremely common problem in robots is "the microcontroller resets when I turn the motor on" problem. When the motor turns on, it briefly pulls the battery voltage low enough to reset the microcontroller. The simplest solution    is to run the microcontroller on a separate set of batteries.
HISTORY OF THE BATTERY:
The first evidence of batteries comes from discoveries in Sumerian ruins dating around 250 B.C.E. Archaeological digs in Baghdad, Iraq . But the man most credited for the creation of the battery was named Alessandro Volta, who created his battery in the year 1800 C.E. called the voltaic pile. The voltaic pile was constructed from discs of zinc and copper with pieces of cardboard soaked in saltwater between the metal discs. The unit of electric force, the volt, was named to honor Alessandro Volta . A time line of breakthroughs and developments of the battery can be seen here .
HOW A BATTERY WORKS:
Most batteries have two terminals on the exterior, one end is a positive end marked “+” and the other end is the negative marked “-”. Once a load, any electronic device, a flashlight, a clock, etc., is connected to the battery the circuit being completed, electrons begin flowing from the negative to positive end, producing a current. Electrons will keep flowing as fast as possible until the chemical reaction on the interior of the battery lasts. Inside the battery there is a chemical reaction going on producing the electrons to flow, the speed of production depends on the battery’s internal resistance. Electrons travel from the negative to positive end fueling the chemical reaction, if the battery isn’t connected then there is no chemical reaction taking place. That is why a battery (except Lithium batteries) can sit on the shelves for a year and there will still be most of the capacity to use. Once the battery is connected from positive to negative pole, the reaction starts, that explains the reason why people have gotten a burn when a 9-volt battery in their pocket touches a coin or something else metallic to connect the two ends, shorting the battery making electrons flow without any resistance, making it very, very hot. 
MAIN CONCERNS CHOOSING A BATTERY:
- - Geometry of the batteries. The shape of the batteries can be an important characteristic according to the form of the robots.
- - Durability. Primary(disposable) or secondary (rechargeable)
- - Capacity. The capacity of the battery pack in milliamperes-hour is important. It determines how long the robot will run until a new charge is needed.
- - Initial cost. This is an important parameter, but a higher initial cost can be offset by a longer expected life.
- - Environmental factors. Used batteries have to be disposed of and some of them contain toxic materials. 
PRIMARY (DISPOSABLE) BATTERY TYPES
- • Zinc-carbon battery - mid cost - used in light drain applications
- • Zinc-chloride battery - similar to zinc carbon but slightly longer life
- • Alkaline battery - alkaline/manganese "long life" batteries widely used in both light drain and heavy drain applications
- • Silver-oxide battery - commonly used in hearing aids
- • Lithium Iron Disulphide battery - commonly used in digital cameras. Sometimes used in watches and computer clocks. Very long life (up to ten years in wristwatches) and capable of delivering high currents but expensive. Will operate in sub-zero temperatures.
- • Lithium-Thionyl Chloride battery - used in industrial applications, including computers and electric meters. Other applications include providing power for wireless gas and water meters. The cells are rated at 3.6 Volts and come in 1/2AA, AA, 2/3A, A, C, D & DD sizes. They are relatively expensive, but have a proven ten year shelf life.
- • Mercury battery - formerly used in digital watches, radio communications, and portable electronic instruments, manufactured only for specialist applications due to toxicity 
(Will be discussing the two most popular secondary batteries)
These batteries are much lighter than non-lithium batteries of the same size. Made of Lithium (obviously) and Carbon. The element Lithium is highly reactive meaning a lot of energy can be stored there. A typical lithium-ion battery can store 150 watt-hours of electricity in 1 kilogram of battery. A NiMH (nickel-metal hydride) battery pack can store perhaps 100 watt-hours per kilogram, although 60 to 70 watt-hours might be more typical. A lead-acid battery can store only 25 watt-hours per kilogram. Using lead-acid technology, it takes 6 kilograms to store the same amount of energy that a 1 kilogram lithium-ion battery can handle. Huge difference!
Begin degrading once they are created, lasting only two or three years tops, used or not. Extremely sensitive to high temperatures, heat degrades battery even faster. If a lithium battery is completely discharged, it is ruined and a new one will be needed. Because of size and ability to discharge and recharge hundreds of times it is one of the most expensive rechargeable batteries. And a SMALL chance they could burst into flames (internal short, separator sheet inside battery keeping the positive and negative ends apart gets punctured). 
The anode, the positive end, is made of zinc powder because the granules have a high surface area, increasing the rate of reaction and higher electron flows. It also helps limit the rate of corrosion. Manganese dioxide is use on the cathode, or the negative side, in powder form as well. And potassium hydroxide is the electrolyte in an alkaline battery. There is a separator inside the battery to separate the electrolyte between the positive and negative electrodes. 
Fuel cells are a possible future replacement for chemical cells (batteries). They generate electricity by recombining hydrogen gas and oxygen. (commercial fuel cells will probably use methanol or other simple alcohols instead of hydrogen). Currently these are very expensive, but this might change in the near future when these cells are more commonly used as a replacement for laptop batteries.
Note: since fuel cells use flammable products you should be extra careful when you build a power source with these. Hydrogen has no odor like natural gas and is flammable and in some conditions explosive.
Pressurized canisters have their own set of risks. Make sure you really know how to handle these. Or at least allow other people enough time to get behind something thick and heavy before experimenting with these.
Another example of mechanical energy storage is the flywheel. A heavy wheel used to store kinetic energy.
Some robots use pneumatic cylinders to move their body. These robots can use either a bottle of pressurized air or have a compressor on board. Only the first one is a power source. The latter power source is the batteries powering the compressor. Pneumatic cylinders can deliver very large forces and can be a very good choice for larger walkers or grippers.
Note: Pressurized canisters and pneumatic components can be dangerous when they are handled wrongly. Failing pressurized components can shoot metal pieces around. Although these aren't necessarily life threatening, they can cause serious injuries even at low pressures.
Canisters on their own pose additional risks: Air escaping from a pressurized canister can freeze whatever happens to be in its way. Don't hold any body parts in front of it.
Pneumatic and hydraulic cylinders can deliver large forces. Your body parts can't handle large forces.
The model airplanes there exist small internal combustion engines. These engines can be used to power robots either directly for propulsion or indirectly by driving an alternator or dynamo. A well designed system can power a robot for a very long time, but it's not advisable to use this power system indoors.
Note: This is another dangerous way of doing things. Fuel burns and is toxic. Small amounts of fuel in a open container can explode when ignited. Exhaust is toxic and a suffocation risk. Make sure of that you know what doing or get good life insurance.