The key to this is that other species evolved from dinosaurs before the dinosaurs died out.
Evolution is a complex process which works by natural selection. Imagine that we have Species A consisting of 100,000 individuals, each of whom have four toes. A random dominant mutation causes an extra toe to develop, causing one individual to become the first of five-toed species A2. Because, let us say, that the extra toe is an advantage in hunting and mating, Species A2 begins to out-compete members of Species A. Over a period of many thousand years, the population gradually shifts from 100 percent consisting of the four-toed species A to a mix of 50,000 four-toed Species A and 50,000 five-toed Species A2, to all of the four-toed members of Species A becoming extinct and the entire population consisting of the five-toed Species A2.
One of the most interesting actual examples of this was the evolution of birds from small carnivorous dinosaurs. Essentially, dinosaurs evolved into an early, birdlike species called Archaeopteryx. Then the dinosaurs became extinct. Next, Archaeopteryx evolved into modern birds. Then Archaeopteryx became extinct.