Lectures on ergodic theory