This annoyance happens usually on dry days after walking on carpeted floors. The friction between the carpet and your shoes or socks causes charges to be moved between your body and the carpet. Usually your body becomes negatively charged. When your hand approaches a doorknob the negative charges in your hand are attracted to the positive charges in the doorknob (created by polarization), causing an electrical spark when the two charges meet.
Circuit boards are sensitive to electrostatic buildup, and can be damaged if such a charge accumulates on sections of the circuit.