After the insertion of Okazaki fragments, the RNA primers are removed (the mechanism of removal differs between prokaryotes and eukaryotes) and replaced with new deoxyribonucleotides that fill the gaps where the RNA  primer was present. DNA ligase then joins the fragmented strands together, completing the synthesis of the lagging strand.
In prokaryotes, DNA polymerase I synthesizes the Okazaki fragment until it reaches the previous RNA primer. Then the enzyme simultaneously acts as a 5′→3′ exonuclease, removing primer ribonucleotides in front and adding deoxyribonucleotides behind. Both the activities of polymerization and excision of the RNA primer occur in the 5′→3′ direction,  and polymerase I can do these activities simultaneously; this is known as “Nick Translation”. Nick translation refers to the synchronized activity of polymerase I in removing the RNA primer and adding deoxyribonucleotides. Later, a gap between the strands is formed called a nick, which is sealed using a DNA ligase.
In eukaryotes the removal of RNA primers in the lagging strand is essential for the completion of replication. Thus, as the lagging strand being synthesized by DNA polymerase δ in 5′→3′ direction, Okazaki fragments are formed, which are discontinuous strands of DNA. Then, when the DNA polymerase reaches to the 5’ end of the RNA primer from the previous Okazaki fragment, it displaces the 5′ end of the primer into a single-stranded RNA flap which is removed by nuclease cleavage. Cleavage of the RNA flaps involves three methods of primer removal. The first possibility of primer removal is by creating a short flap that is directly removed by flap structure-specific endonuclease 1 (FEN-1), which cleaves the 5’ overhanging flap. This method is known as the short flap pathway of RNA primer removal. The second way to cleave a RNA primer is by degrading the RNA strand using a RNase, in eukaryotes it’s known as the RNase H2. This enzyme degrades most of the annealed RNA primer, except the nucleotides close to the 5’ end of the primer. Thus, the remaining nucleotides are displayed into a flap that is cleaved off using FEN-1. The last possible method of removing RNA primer is known as the long flap pathway. In this pathway several enzymes are recruited to elongate the RNA primer and then cleave it off. The flaps are elongated by a 5’ to 3’ helicase, known as Pif1. After the addition of nucleotides to the flap by Pif1, the long flap is stabilized by the replication protein A (RPA). The RPA-bound DNA inhibits the activity or recruitment of FEN1, as a result another nuclease must be recruited to cleave the flap. This second nuclease is DNA2 nuclease , which has a helicase-nuclease activity, that cleaves the long flap of RNA primer, which then leaves behind a couple of nucleotides that are cleaved by FEN1. At the end, when all the RNA primers have been removed, nicks form between the Okazaki fragments that are filled-in with deoxyribonucleotides using an enzyme known as ligase1, through a process called ligation.