The abundant sun rays hit the solar panel installed in the area where their are no obstacles most preferably roof tops.The solar panels consists of photovoltaic cells(PV).
Each photovoltaic cell is basically a sandwich made up of two slices of semi-conducting material, usually silicon — the same stuff used in microelectronics. To work, photovoltaic cells need to establish an electric field. Much like a magnetic field, which occurs due to opposite poles, an electric field occurs when opposite charges are separated. To get this field, manufacturers "dope" silicon with other materials, giving each slice of the sandwich a positive or negative electrical charge.
This electrical charge generated is then rendered to electrical appliances like mixers, TV sets etc. And the extra electricity generated is transmitted to the grid.