To get a little deeper into the behavior of silicon you need to go into how electrons arrange themselves in an atom. Electrons like to arrange themselves into orbitals. The mechanics behind why they do this has to do with the wave properties of matter and getting into that is going a little too far here. Basically, electrons are only allowed to have certain energies in their orbits and certain patterns of orbits have less energy than others. When the electrons fit into a nice pattern it takes more energy to free up an electron than when they don't.
The orbitals for the smaller atoms (Silicon is relatively small) have orbitals called s or p and the first s and p orbitals are arranged like 1s 2s 2p 3s 3p where each number corresponds to a shell. When an atom has a full shell it is really happy. Too happy. Atoms where the electrons make full shells are very inert and will not react much with other atoms so they are difficult to manipulate. Each s orbital holds up to 2 electrons. Each p orbital consists of three sub-orbitals that hold 2 electrons each, for a total of 6 electrons and electrons per p orbital. A neutral silicon atom has 14 electrons. This gives silicon full 1s and 2s orbitals and then a full 2p orbital, with four electrons left over.
The electrons in the full shells are called "core electrons" because they don't interact with anything outside of their silicon atom. The left over electrons don't organize themselves so neatly. The 3s and 3p orbitals rearrange themselves to form four sp3 hybrid orbitals of equal energy, each containing a single electron. Since these electrons are not in complete shells, they can react with electrons in the incomplete outer shells of other atoms to form bonds. These electrons that are available to form bonds with other atoms are called valence electrons.
Electrons don't just interact with the nucleus that they are orbiting. They interact with the electrons of other atoms around them. This is how atoms bond together and materials like silicon form crystals. Silicon has four valence electrons. Two valence electrons from different atoms can pair up and form a strong bond which is called a covalent bond. Having four valence electrons an atom of silicon is able to bond with four other atoms of silicon and form a nice strong crystal. The entire crystal is made up of bonded atoms of silicon, each atom bound to four others around it.
Phosphorous has one more electron than silicon does. Because of this, phosphorous is able to fit pretty nicely into a silicon crystal, except that it has five valence electrons instead of four, leaving one extra electron that doesn't fit well into the silicon crystal structure, which prefers to have four valence electrons for every atom. This makes the extra electron a "hot potato" of sorts within the crystal. It's not that it will fly off for no reason, since the charges between protons and electrons are still balanced, but it doesn't take a lot to free that electron, and that makes phosphorous doped silicon something that can conduct electricity.
Boron has five electrons. The two in the 1s orbital form the core, and the 2s and 2p orbitals contain three valence electrons. If a boron atom is in the middle of a bunch of silicon atoms it tries to join in the arrangement where four electrons are shared, but it is one electron short. Because of this there is what is called a "hole" for an electron where a boron atom sits inside a silicon crystal. These holes make a path for electrons to travel (hopping from hole to hole) and allow the material to conduct electricity.
PV comes together
When you take a thin slice of N-type silicon (free electrons) and slap it onto a thin slice of P-type silicon (wants electrons) and you do something to kick loose some electrons (the photoelectric effect), you get a situation that can provide power. Free electrons will want to hang out more on the P side than they will on the N side. The number of protons on either side doesn't change, so you end up with the N side having a net positive charge (electrons are negative) and the P side having a net negative charge.
The separation of charges creates an electric field. The continued exposure to light keeps knocking electrons loose and the electric field exerts a force on the electrons. If you give the electrons a path (an electrical circuit) they will flow away from the negatively charged area and towards the positively charged area. The electrons will be able to overcome some resistance on this path and that means they can do work, like light up a light bulb.