Almost everything can garner a static electricity charge. The capability to store or let go of that charge depends on the material. Static electricity occurs when there is a disproportionate amount of positive and negative charges in an object. That charge is released when certain materials rub up against each other, creating a transfer of charges from one object to the other.
According to Alliant Energy Kids, one spark of static electricity can elicit 3,000 volts. This is far greater than a home's electrical system.
Bit of Science
Matter is made up of atoms. The atoms have protons (a positive charge), electrons (negative charge) and neutrons (neutral). Opposite charges attract each other (positive and negative), while the same charges repel each other (positive and positive or negative and negative). For the most part, the positive and negative charges are typically balanced. When that balance becomes disturbed, static electricity occurs.
When you take your hat off, your hair stands up on its end. This is the result of electrons moving from your hat to your hair. Your hairs have the same charge, so they will repel one another.
It's Not Really Magic
Think how a balloon can stick to a wall. When you rub the balloon against your clothes, then stick it to a wall, you are accumulating more electrons on the balloon's surface. The balloon will stick to the wall, because the wall is more positively charged, proving the opposites-attract rule.
When you walk across a carpet, the electrons move from the carpet to your feet. Your feet are now charged with extra electrons and a negative charge. When you go to touch a doorknob, you feel a zap. The doorknob is known as a conductor, or something that makes the electrons move easily to the other object. The electrons easily jumped from you to the doorknob, causing the static shock.