It is vital for a bird, being a 'warm-blooded' vertebrate, to keep warm in order to maintain its body at a constant temperature. At extremely cold or hot conditions, it would not be able to do it continuously and hence needs to migrate.
Remember that the reasons for bird migration are complex and not fully understood. But a simple explanation is food and a safe place to breed. Food, water, protective cover, and a sheltered place to nest and breed are basic to a bird's survival. But the changing seasons can transform a comfortable environment into an unlivable one -- the food and water supply can dwindle or disappear, plant cover can vanish, and competition with other animals can increase.
Hence migration helps them to reach places with ample food, suitable temperatures and safe conditions to breed.