Carbon has 4 electrons in its outer shell, so to fill its outer shell (which can hold up to 8 electrons) and be stable, it wants another 4 electrons. It can do this by sharing its 4 electrons in 4 strong covalent bonds with another 4 carbon atoms, in an continous macrostructure called Diamond that has a regular tetraheral pyramidal lattice arrangement. Because it has no free electrons and all the atoms in the lattice are bonded covalently, diamond does not conduct electricity and is very hard, so its useful as a knife for cutting.
But, sometimes, atoms don't need an entirely filled outer shell. Carbon, as it turns out, can form a stable macrostructure with just 7 electrons filled in its outer shell, which we call Graphite. Because it only needs 3 more electrons, it forms only 3 covalent bonds with other carbon atoms. This forms a regular hexagonal planar arrangement. In Graphite, you have many layers of this arrangement, that are linked via weak intermolecular forces. Because these forces are weak, that means that you can apply a small force and the layers slide over each other, which makes it useful as a lubricant. The layers can also separate completely, which is why graphite in pencils separate as you press the pencil tip into the paper, and leave behind the graphite as your writing. One last to remember about graphite, is that only 3 of its 4 electrons have been used to make covalant bonds, so there's still one electron left per carbon atom. These electrons can flow through the hexagonal planes freely, so we call them delocalised. Electricity is generated from the movement of electrons, so having delocalised electrons means that Graphite can conduct electricity.