Raghuram G. Rajan, who as governor of the Reserve Bank of India has been popular with investors but faced opposition from India’s ruling party, said he would leave when his term ends in the fall.