Your heart’s sinus node is your natural pacemaker. It sends an electrical impulse to make your heart beat. The job of a pacemaker is to artificially take over the role of your sinus node. Electrical impulses are sent by the pacemaker to stimulate your heart to contract and produce a heartbeat. Most pacemakers work just when they’re needed - on demand. Some pacemakers send out impulses all of the time - this is called fixed rate.
Pacemakers do not give your heart an electrical shock.