What is the difference between the following?
How had he lost weight?
How did he lose weight?
In what situations, both has to be used?
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?
How did he lose weight? [last year, last month, a few years ago, in short, at a time in the past that is not the now] Time of this utterance: The Present. Tense of utterance: Simple Past
How had he lost weight? [before some date in the past, before some moment in the past, before some occurrence in the past.] Time of utterance: The Present Tense of utterance: Past Perfect
Sentence ONE is like this: (the PAST)_______________X (present] ___________________________
Sentence TWO is like this: (the PAST)____/(some moment or date)_______X(present) ________
The past perfect takes places at or before the /.
Example: How had he lost weight? [/=when he dieted in the summer]