There are two different types of procedures for the treatment Atrial Fibrillation

Pacemakers

A pacemaker is a small electrical device implanted in the body. It has wires going to the heart to regulate the heartbeat. The pacemaker is implanted under the skin near the collarbone and sends out an electrical signal to keep a steady contracting rhythm in the heart. Some pacemakers sense when the heartbeat is too fast or too slow. When this happens, the pacemaker fires impulses that help the heart return to the proper rhythm and speed. 

Open-heart maze procedure 
Open-Maze heart surgery is a complex procedure in which a surgeon creates small cuts in the upper part of your heart. The cuts are then stitched together. As a result, scar tissue forms. The scars interfere with the transmission of electrical impulses that can cause AFib. Normal heartbeat is then restored. 

 

Article from the American Heart Association