"And the beneficial knowledge has certain ways and means by which it is obtained and certain paths that are taken in its acquisition and memorisation. Amongst the most important of them are:
That the servant asks his Lord for the beneficial knowledge and that he seeks assistance by Him, the Exalted, and shows his need to Him. Allaah ordered His Prophet, Muhammad (sallallaahu alayhi wasallam) to ask Him that He increases him in knowledge, in addition to his knowledge. He, the Exalted said:
And say: O Lord, increase me in knowledge [Taa Haa 21:114]
And the Messenger (sallallaahu alayhi wasallam) used to say: "O Allaah, benefit me with what you have taught me and teach me that which will benefit me and increase me in knowledge."
And this is the greatest and the essence of them all,
sincerity in seeking the knowledge.
The Messenger (sallallaahu alayhi wasallam) said: "Whooever learnt knowledge by which the Face of Allaah is to be sought, but he does not do so except for attaining a goal of this world, he will not smell the fragrance of Paradise on the Day of Resurrection."
Striving and exerting oneself in seeking knowledge, having keen interest for it, having a true desire in which the pleasure of Allaah, the Most-High, is sought and adopting all of the ways and means in seeking knowledge of the book and the Sunnah.
A man came to Abu Hurairah (ra) and said: "I desire to learn the knowledge but I fear that I may waste it." So Abu Hurairah replied to him: "Your abandonment of learning it is sufficient in wasting it."
And for this reason one of the wise people, upon being questioned, "What is the way by which knowledge is obtained?", answered: "With eagerness is it followed, with love is it listened to, with sole concern is it gathered, [teach your knowledge to the one who is ignorant, and learn from the one who teaches, for if you do that, you will come to know what you were ignorant of and you will memorise that which you (yourself) have learnt."] 
And for this reason, Imaam ash-Shaafi'ee (rh) said:
My brother! You will not acquire knowledge except by six matters
I will inform you of their detail with an explanation
Intelligence, zeal, striving, competence/proficiency
The companionship of a teacher, and a long time!
Avoiding all disobedience by having taqwaa of Allaah, the Most-High, for that is the greatest of means in acquiring knowledge, as He, the Most-High, has said:
Have taqwaa of Allaah and Allaah will teach you, and Allaah has knowledge of every single thing. [Baqarah 2:282]
And He, the Most-High, also said:
O you who believe! If you have taqwaa of Allaah, He will grant you a criterion (to judge between truth and falsehood) [Anfaal 8:29]
And this is clear and manifest, that the one who has taqwaa of Allaah, He will grant him knowledge by which he will distinguish between truth and falsehood. For this reason Abdullaah Ibn Mas'ood (ra) said: "Indeed, I consider that a man loses knowledge which he once had, due to a sin which he committed."
And Imaam ash-Shaafi'ee (rh) said:
I complained to Wakee' about the poorness of my memory
So he directed me to abandon disobedience
And informed me that the knowledge of Allaah is light
And [that] the light of Allaah does not guide the disobedient
And Imaam Maalik
said to Imaam ash-Shaafi'ee - may Allaah have mercy upon them both -: "I see that Allaah has placed light in your heart so do not extinguish it with the darkness of disobedience."