Our Constitution does not provide as to how the Prime Minister shall be appointed. Article 75 of the Constitution only provides that the Prime Minister shall be appointed by the president. But the convention of the Cabinet form of Government is that the Head of State calls upon the leader of the majority party to be the Prime Minister and to form his Cabinet. Similarly in India, the leader of the party winning a clear majority as a result of the general elections to the President. Other Ministers are appointed by the President on the advice of the Prime Minister.
The Prime Minister holds office during the pleasure of the President. Normally the President cannot dismiss the Prime Minister at will because the former is convention-bound to-recognise the person commanding leadership of the majority party in the Lok Sabha as the Prime Minister. The Prime Minister holds office till the new Lok sabha is dissolved by the President, he can ask the Prime Minister to hold office till the new Lok sabha is elected.