The code looks fine to me. If the results aren't what you expect then maybe the structure of the tree isn't what you think?
2) How it resets to root to go to right subtree from last left tree leaf?
The beauty of recursion is that each call has different parameters (and local variables). So you don't need to "reset to root": when you return from a lower call, the previous value of root is there unchanged. Actually, to express this better in your code, don't make root a reference, and call it subtree: