How Reinforcement Learning Works