As we walk across a carpet, our shoes rub against the carpet, which makes electrons move from the carpet to our shoes. Then, these electrons fly over our body. We become negatively charged and the carpet become positively charged. As a result of an imbalance of electrons and protons, a static charges is built up.