All materials are made up of negatively- and positively charged particles. These usually exist in equal amounts, balancing each other out. But when two materials come into contact, one may 'steal' negatively-charged electrons from the other. One material ends up with more negative charges than positive ones, meaning that it becomes negatively-charged overall, whilst the other becomes positively-charged. If the charges cannot move away as they are produced, they accumulate in the material as static charge, or electricity.Once you have built up a big enough static charge, an electric shock is almost inevitable. The moment you touch a conducting material such as metal, the excess electrons jump between your hand and the conductor, giving you a shock.