The French prime minister is expected to resign and the country may face a hung parliament after an unexpected win for the left.