Suppose we have multiple copies of a given DNA fragment. For the reasons which will become clear in the next section, we want to create an entire sequence of nested subfragments including the original fragment, and we want to know what base each fragment ends with. In 1974 two methods that do exactly that came independently from English group headed by Sanger and American group headed by Maxam and Gilbert. Both groups shared the Nobel prize for it. American method was based on chemical cleavage protocol whereas Sanger's method essentially mimics DNA replication in-vivo. Sanger's method turned out to be implementable in large--scale production sequencing and this is what everyone uses now.
As the next figure shows, suppose we start off with double--stranded DNA fragment which we intend to sequence. Also, assume that there is a piece of the fragment (usually between 12 and 24 bps long) whose sequence is known. The complement of known sequence which goes in 5'-3' direction is called a primer because it primes for the following reaction. ( In-vivo the RNA serves as a primer and attaches itself to DNA molecule at the origins of replication.) The next step is to denature (melt) the fragment and anneal the primer to its 3'-5' complement. The primer is chemically synthesized and it anneals to its known complementary sequence with hydrogen bonds. Primers need to be long enough for the attachment site to be unique. If we make them too short, there is a non-negligible chance of finding fragments containing this sequence somewhere else purely by chance. If we make them too long, annealing may be unstable).
Now, let's see what happens in-vivo. RNA attaches itself to the origin of replication, and catalyzed by the enzyme DNA polymerase, nucleotides (dNTPs: deoxynucleotide triphospates) start coming and join in, each incoming base is being determined by a complementary base on the template (original sequence). Replication always occurs in 5' to 3' direction, so, one strand can always be replicated continuously whereas the other has to be done ``in pieces''. However, we don't encounter this issue in our problem since we can always take the 3' to 5' strand. The incoming nucleotide forms a covalent bond with the 3' end of the previous sugar using its 5' end. In the absence of adverse conditions, the nucleotides keep coming in till the end of the template is reached, i.e, the strand is fully extended. Sanger's idea was to modify this process so we would be able to stop the process before it reaches the end of the template.
How is it done? Suppose that we take one of the nucleotides and modify it in a way that once it gets incorporated into the sequence, the next incoming nucleotide will be unable to attach. There an easy way to do that by replacing hydroxyl group OH on the 3' end of this nucleotide with hydrogen H. Then replication will stop. Such modified nucleotides are called ddNTPs or di-deoxynucleotide triphosphates and we will call them terminators.
So, we proceed in the following way. After the primer is attached we add the enzyme DNA polymerase which will catalyze the reaction involving nucleotides and terminators. A different fluorescent label is attached to each of the four terminators. (In some implementations, the label is attached to the primer). The relative concentrations of the dNTP's and ddNTP's are adjusted in such a way that we end up with about the same number of copies of fragments between 100bp and 500bp long, and a smaller number of shorter and longer fragments. The following is an example of how Sanger's method works.
Sanger's Method So, we can see that in one of the copies ddCTP got incorporated right away and replication stopped immediately. On another copy 2nd base T got incorporated as ddTTP whereas the first one following the primer was dCTP and replication was able to continue.
Note, that if we attached the label to the terminator then we are able to do everything in just one test tube since we will be able to determine which fragment ends with what base by looking at the label. However, if the label was attached to the primer would have to use 4 test tubes, and include only one type of ddNTP in each.