When is a pacemaker used?

When is a pacemaker used?