To convert the ketone groups into C=S (thiocarbonyl) groups, in theory, H2S could be used, however in practice, electrophilic reagents are used instead. In this example a large reagent called Lawesson’s reagent is used, P2S5 could also be used.
Lawesson’s reagent must first split in an unfavorable reversible reaction before it can be react.
The thionating step involves the one half of the split Lawesson’s reagent and the diketone.
The final step is the cyclisation to the aromatic thiophene. Thioketones are much less stable than ketones, so the cyclization is fast.
T. Ozturk, E. Ertas and O. Mert, Chem. Rev., 2007, 107, 5210–5278.