RNA polymerase continues transcribing until it transcribes a DNA sequence known as a terminator, which signals that the transcript is complete. This gives the polymerase a signal to stop transcription. The process of ending transcription is known as termination. Bacteria has two major termination strategies - Rho-dependent and Rho-independent.
In Rho-dependent termination, transcription terminates when the RNA polymerase approaches the binding site for a protein known as Rho factor.
In Rho-independent termination, transcription terminates when the RNA polymerase hits a region rich in C and G nucleotides as it approaches the end of the gene being transcribed. This results in a hairpin formation, which obstructs the polymerase and terminates transcription.