Factbox - Spain starts complex process to choose prime minister

MADRID (Reuters) - Conservative Prime Minister Mariano Rajoy won Spain's general election on Sunday, but his People's Party was short of a majority and needs allies to form a government. Meanwhile, left-wing parties gained ground in the vote and were close to winning an absolute majority although an alliance between those groups which differ on economic policy or on the degree of autonomy that Catalonia should enjoy will not be easy to agree on. Pact-building talks could take weeks, and there is no clear or easy alliance in sight. Nor does the Spanish constitution set a specific deadline to form a government after the election. Following are the key issues and scenarios which will determine who becomes Spain's next premier: CALENDAR Once the new parliament and senate are operational, from Jan. 13 onwards, it will be up to the King Felipe VI to put forward a candidate to be sworn in as prime minister, once alliance talks have taken place. If this candidate fails to obtain an absolute majority, a simple majority vote is held 48 hours later. If the vote is lost again, the King has to put forward a new candidate. If no candidate secures a majority within two months of the first vote, new elections have to be held. However, Spain's constitution does not set a deadline for the King to put forward the first candidate, meaning that much will depend on the negotiations between the different factions. In the 11 general elections held since 1977, it never took less than a month nor more than two months to form the new government but most analysts agree it could take much longer this time and fresh elections are a distinct possibility. CENTER-RIGHT PACT BETWEEN THE PP AND CIUDADANOS Such a pact would fall far short of the 176 seats needed for an absolute majority, totaling 163 seats. So they would need all other parties to abstain, which seems unlikely. CENTER-LEFT COALITION BETWEEN THE SOCIALISTS AND PODEMOS The two parties, along with other leftist group Izquierda Unida would total 161 seats, also short of an absolute majority. Podemos leader Pablo Iglesias has said he would ask for major concessions from the Socialists before agreeing to any alliance. Such a coalition would also need to win the backing of at least three other members of parliament, whether from other leftist forces such as Esquerra Republicana de Catalunya or EH Bildu, moderate Basque party PNV or regional group from the Canary Islands Coalicion Canaria. That points to long and difficult talks as well as a potentially weak government as neither Podemos nor any of the other groups are in principle willing to enter into a Socialist-led administration. 'GRAND COALITION' BETWEEN THE PP AND THE SOCIALISTS It would total 213 seats but both Rajoy and Socialist leader Pedro Sanchez have ruled it out on several occasions. (Reporting by Julien Toyer and Elisabeth O'Leary; Editing by Mary Milliken)