All vertebrates have closed circulation systems.
In fish a single cycle circulation system (one circuit of blood flow) is present. The heart has two chambers (1 atria and 1 ventricle) and equal to one pump.
In amphibians there is a double circulation system. But the heart is not completely split in to two pumps. So oxygenated and de-oxygenated bloods are mixed. They have three chambers (2 atria and 1 ventricle) in heart.
In reptiles there is more development of circulatory system. The ventricle is partially separated. The second circulation circuit functions and helps their blood to be cold. Blood flows from heart to capillaries and back to heart instead of lungs. They have 3 chambers (2 atria and 1 ventricle) in heart. Only crocodiles have 4 chambers (2 atria and 2 ventricles).
In mammals the double circulation system is complete with four chambers and two pumps. Systemic and pulmonary circulations (lungs) are fully separated. The birds also have a double circulation system with four chambers and two pumps. The secondary circulatory system (lymphatic system) collects fluid and cells and returns these to the cardiovascular system.
Also heart beat also changed in the evolution process. Fish have 80 to 200 beats/sec. Amphiians and reptiles have it very less. Crocodiles have below 30 beats/sec. Human beings have 72 beats/min. Birds heart beat rates are 200 or more.
Size & weight of heart in proportion to size & weight of organisms is larger for smaller organisms. Fish have largest proportion of heart wrt body.
This evolution helps the organisms in their energy circulation needs due to their size, energy consumption, their environment, speed of movement etc.