The choice of tense here is somewhat restricted by the meaning of expect, which means to anticipate that something will happen. When we expect something, we believe it will happen; we await it.
When that which we expect to happen turns out to happen or to not happen, we no longer have the expectation. The expectation is abandoned either because now we know otherwise, or because what we expected to happen has indeed happened. When it has rained cats and dogs and our shoes are already ruined, we cannot expect them to get ruined. We cannot expect the 4PM train to be late if it is 4PM and the train has already arrived on time.
If we are speaking of an expectation as either an ongoing state of mind or as an abandoned state of mind, we do not use the present perfect with expect . If the expectation is abandoned, it is a thing of the past.
What did you expect?
What were you expecting?
If the expectation is ongoing, it is a thing of the present.
What do you expect?
What are you expecting?
Only when we wish to speak of the expectation as one that may be in transition from held belief to abandoned belief does expect hook up with the present perfect, though even then the two are awkward dancing partners.
What have you been expecting?
What have you expected?
What have you been believing?
What have you believed?
The present perfect could also be used to mean "things that I have believed over the course of my lifetime which I no longer believe, but I own to having believed them".
Have you expected Santa Claus to come down the chimney?
Have you expected the Tooth Fairy to leave money under your pillow?
Have you expected business partners to be honest and above-board?
Interesting question, the meanings are very similar, for the difference is context.
I didn't sing the song - This is a sentence that can stand alone, in response to a question or as a statement of fact.
I had not sung the song - This phrasing would typically be used in context of another event, or as part of an explanation to a series of events. On it's own this sentence would seem strange.
i.e. "Until I knew the tune, I had not sung the song"
Best Answer
How had he lost weight: this is the past perfect tense. How did he lose weight: this is the simple past.
Explaining random examples without context require us to first look at the grammar rule in detail:
one of the uses of past perfect is to show sequence of past activities, e.g., he watched the film with his friend yesterday even though he had already seen it the previous month (2 past actions, yesterday and a month ago): our question here could be: when had he seen the film for the first time?
the simple past is used for an activity which has finished in the past and where the time has also finished, e.g., he drove to Berlin last week: our question here could be: when did he drive to Berlin?
So, coming back to the specific examples, the past perfect question needs to be used together with another past action,
e.g., he wrote a diary of how had he lost weight: question: how had he lost weight? (referring to the time before he wrote the book). It is not wrong to also ask here, how did he lose weight?
e.g., he lost 10 kilos and felt much happier: question: how did he lose weight?