The adverb 'ever' is used to add emphasis to a sentence, especially in questions and sentences that have a negative meaning and also sentences that use the present perfect tense.
'ever' has several meanings:
- at all times; always; continuously; at any time; in any possible case; by any chance; at all (often used to intensify or emphasize a phrase or an emotional reaction as surprise or impatience): e.g.,
- How did you ever [at any time/by any chance] manage to do it?
- If he ever [at any time] comes here again, I will refuse to speak to him.
- He denied that he had ever [at any time/by any chance] seen her.
- Please forget that I ever [at any time] told you anything about it.
- Few people have ever [at any time] seen her laugh.
Question sentences can be emphasised by adding 'ever'.
- Why ever did he marry her?
- How did he ever learn to do that?
- WHEN WILL YOU EVER LEARN? [at any time in the future]
So, the two sentences are asking the same question, and either sentence can be used to ask the question, but adding 'ever' adds emphasis by saying or suggesting that you wonder if the learning will 'ever/at any time in the future' happen.