Denmark's prime minister Mette Frederiksen won the election but lost ground as her left bloc fell short of a majority.