From clouds to stars - Protostellar collapse and the evolution to the pre-main sequence I. Equations and evolution in the Hertzsprung-Russell diagram