Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How can we attain hope in Allah?
We must seek to attain knowledge of Allah through knowledge of His attributes: His greatness, His immense kindness to His slaves, that He gives without account, that everything in His hands and that His mercy precedes His wrath. The more we attain knowledge of Allah the more we will attain hope in Allah.
How is it possible to remove from the heart all fear of other than Allah and all hope in other than Allah?
What is required is sincerely seeking this from Allah and seeking knowledge, specifically by reading the books of the people of Allah. These are the means of seeking all praiseworthy attributes.