If you are playing around with R/stan and struggling to get your head around the HMC/NUTS algorithm, I highly recommend the following blog by Prof. John Thompson which is a very educational description of the underlying principles (using Stata though):
Stan with Stata, Part V: Kicking a marble around in a bucket