“And turn in repentance and in obedience with true faith to your Lord and submit to Him before the torment comes upon you, and you will not be helped, and follow the best of that which is sent down to you from your Lord…” 
So, expecting the best of Allah on one’s deathbed is to be certain in His promise to the believers and to have confidence in his Guardian that He will not forsake him or waste his efforts in the days past, as the Prophet (sallAllahu ‘alaihi wa sallam) said:
“None of you should die except that he expects the best from Allah.” 
Expecting the best of Allah during your life is just as the verses describe: turning to and relying on Him, and to flee unto His Pleasure with your good deeds, and to distance yourself from the path of those who have low expectations of their Lord and disobeyed Him as a result.
This is the difference between relying on your hopes in Allah (the way of those who disobey Him) and expecting the best from Allah (the way of the believers). Relying on hope occurs when one is lazy, follows his desires, and avoids the path of truthfulness, effort, repentance, turning to Allah, and doing good deeds – all the while having hope in Allah.
As for the praiseworthy form of expecting the best and the legislated manner of having hope, this is when one actually makes an effort while having good reliance on Allah.
The first is like the case of one who wishes he had some land that he would plant some seeds in and harvest without moving a finger or doing anything on his part, or one who wishes to have children without getting married and having relations.
The second is like the case of one who plows the land and plants seeds and harvests it, and hopes for a good and beneficial harvest. This is why the people of knowledge are agreed that hope and good expectation is not valid without some action, and we have already mentioned the words of the Mother of the Believers (radhyAllahu ‘anha) that show her intelligence and experience, such that she emphasized that Allah will never cause the good deeds of anyone to go to waste.
So, in order for your good expectations of Allah to be a vehicle to push you to your Beloved and to ease the journey for the traveler to the Hereafter, you must complement it with actions, and the righteous people have mentioned countless times the need to have good expectations of Allah, and all of their statements point to this condition. So, Ibn Abi Ad-Dunya related in his book ‘Husn adh-Dhann bi Allah’ with his chain from ‘Ali bin Bakar that he was asked about having good expectations of Allah, and he said: “It is that you are not gathered with the sinners in one place,” and he meant that you do not enter Hell, the abode of ruin. This necessitates that you are not gathered with them in this world doing the same evil action or traversing the same deviated methodology as they are, or that you are both in a place of sin and indecency. So, whoever separates himself from the enemies of Allah in this world and breaks himself off from them and declares them his enemies and saves himself from their ways, he can then expect the best from his Guardian that he will be saved from their destination and punishment, separated from them in the Hereafter just as he was separated from them in this world.
 Surah Az-Zumar; 54-55.
 Reported by Muslim (2877).
Please write: COMMENT in this box to verify that you are human