Coronavirus: Where do governments borrow money?

How does it work when a government wants to borrow money, and when does it have to pay it back?