The Socialist may remain prime minister if he can cobble together enough support from wildly different political groups.