They issue Bonds or Treasury Bills which offer interest. They in turn sell them to investors ( you, me, other countries ) and offer interest on the money.
The government also borrows money outright from other countries, or issues other debt obligations that pay interest in exchange for funds.
We, the taxpayers are in essence their credit cards. The politicians and government officials, and unionized bureaucrats do not care at all how or where they get the money from since they are not personally liable for any of it ---- we are.