A minor point, but central banks also pay for operating expenses. So they have to spend some of the surplus on salaries, building maintenance, etc. And they also get more surplus by printing physical money.
However in most countries it is included within the charter of the central bank that any surplus left over at the end of some period is to be transferred to the government treasury. The government is then free to spend this surplus.
This is one of the reasons for the seperation of the central bank and the government. If a government had control of the bank it could be tempted to instruct the bank to create a surplus and then use said surplus to finance government expenditures. This is deemed undesirable as it inreases inflation.
Should a central bank somehow end up with a deficit rather then a surplus it falls to the treasury to help them out (if needed).
You can read about details in the FED's charter:
The ECB also has a paper with some info on this. Point 2.1.:
Overview of profit distribution and loss coverage
In general terms, a central bank’s annual net profits (recognised positive and
negative income, less operating costs) can either be passed on to shareholders
(government and/or private sector) in the form of a dividend, or added to its financial
reserves. In cases where a central bank has either both public and private ownership
or only private ownership, the amount of profit that can be distributed to private
shareholders is typically subject to a cap (ranging from 6% to 12% of the nominal
value of the paid-up capital), while the remaining distributable profit, net of any
transfers to equity (capital and reserves) goes to the government.