Can a central bank simply by fiat change its holdings of its own currency, and then use this new money in any way they please?
Theoretically it can, if you don't mind destroying credibility and the economy in the process. In modern economies there are regulations in place that make this impossible. So no.
Do they later have to "pay back" this money to balance the books, or can they simply forget about it?
If they keep "printing" new money and keep paying back old money in perpetual, the net effect is not having to pay back. So the US government can afford US\$19T of debt. But technically they have to pay back. See long answer below.
Or more concretely: if the ECB buys bonds with newly created electronic money, and these bonds later default, would that be a problem for the ECB or could they laugh it off?
ECB can laugh it off, but Draghi can't, and certainly Eurozone can't either.
First you have to look into the process of money creation. Let's say you provide an ounce of gold bar (asset) to the Fed, in exchange the Fed will pay you an equivalent sum for your gold, say US\$35. The gold is now in the Fed's reserve (it is called Federal Reserve for a reason). Archaically, you can redeem your gold bar with US\$35 (or whatever the current market price is).
However, note that debt instruments (i.e. bonds) are also assets. Therefore the government can issue short-term bonds to the Fed, which the Fed will put them in its reserve, and hand the cash to the government. The book is still balanced because the bonds in reserve are now "disabled", just like you cannot use your gold bar anymore when it's in reserve. But there will be more liquid cash in the market, cash that can be used to do other things, such as investment. When the bonds mature, the process is reversed. Furthermore, the interest (profit) earned from the government bonds will also be remitted back to the government, so the book is still balanced even when interest is taken into consideration.
Quantitative easing isn't all too different. In addition to government bonds, the central bank is now allowed to buy a set quantity of financial instruments that it normally wouldn't have access to, in the same exchange mechanism as stated above. QE allows central banks to (directly) influence interest yield of other instruments, in addition to the usual interbank interest rate which is already close to zero. A lower interest rate makes investment more attractive, which drives the economy. As a side effect from supply demand, now that there is more cash in circulation, exchange rate falls, which makes foreign direct investment attractive because US assets cost less in foreign currencies's perspective.
Now, what if the bonds default? Let's suppose there are US\$100 out in circulation, backed by US\$100-equivalent of reserves. If US\$20 of the bonds default, the value of the US currency in circulation will drop in value accordingly in terms of exchange rate. i.e. nominally the dollar notes still say US\$100, but the actual purchasing power will drop to only US\$80.
(Consider that initially US\$20 of reserve is in bond and US\$80 is in gold. When you reason further, had it been a fixed exchange rate system, once the bonds default, if the owners of the US\$40 of gold rush to redeem their gold at a fixed rate, the reserve will now be worth US\$40. The remaining US\$60 in circulation will now have only 2/3 of it's initial purchasing power (compare with 80% purchasing power right after the default). If all US\$80 of gold reserves is redeemed, the remaining US\$20 in the market will worth US\$0. This is one of the reasons why fixed exchange rate won't work: Once there has been a default and people rush to redeem the reserves, hyperinflation follows.)