The Holy Prophet did not nominate a successor. On the death of the Holy Prophet, Abu Bakr was elected as the Caliph. According to some accounts it appears that Ali did not offer allegiance to Abu Bakr, and that he offered such allegiance after six months when Fatima had died. According to other accounts, Ali offered allegiance to Abu Bakr soon after his election.
After Abu Bakr, Umar became the Caliph. During the caliphate of Umar, Ali was a member of the Majlis-i-Shura, and he fully cooperated with Umar
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari