When should I use lockout feature on my fork? I have a trekking bike with a 63mm fork which has a lockout feature enabling the control of the suspension.

Can you explain when should I lock the fork, in what position and why?

One obvious example would be when climbing hills, one should lock the fork in minimum suspension (almost no suspension, the fork is stiff/hard as if there is no suspension at all). The reason is to prevent that the part of the energy is lost on the amortization...

But, what are other examples? What should one do when going down the hill? Or going really fast?
Anytime the fork bob is robbing you of power. That can include flats, sprints, climbing... Best advice is probably to try it out on all the terrains you ride and decide where it works and where it doesn't.