The Spanish prime minister's electoral defeat deprives Europe's centre-left of its most prominent leader, leaving socialists increasingly marginalised in Brussels and facing difficult questions about how to win back power.