After having shown how the thermodynamic formalism can be applied to continuous time Markov processes, we shall cast the latter formalism within the borader framework of large deviations, thus establishing a bridge towards the fluctaion theorem. We shall be interested in a much simpler than usual observable, namely the number of events that have occurred in a fixed time interval, and we will show that the distribution of the latter observable contains the signature of dynamical phase transitions in systems in or out of equilibrium.  Finally, we will introduce the tools allowing us to characterize dynamic phase transitions in terms of phase separation within the space of trajectories. We will illustrate our approach with concrete examples (random walks, exclusion processes, Ising model).