After her party's weakest showing since 1903, Mette Frederiksen spent months negotiating a coalition to stay in power.