Fins are essential to fish, the predecessors of legs they give a fish lift, steering capability, braking and momentum. In some species they are used to hold on to the substrate while in others they allow the fish to walk, or even to fly. Without fins a fish would just be a fancy worm.
The earliest known fishes had fins, albeit not as many as modern fish, but even the most ancient and primitive agnatha had a caudal fin. The cephalaspids had one or two dorsal fins and an anal fin as well as a pair of primitive pectoral fins. By the time of the placoderms pelvic had also evolved.
The shape and structure of a fish's fins reflect both its lifestyle and its evolution. The ancestors of modern fish, both bony and cartilaginous, looked, in terms of their fin structure, much like modern dogfish and sharks. The evolution of the modern design, with a symmetrical tail and highly manoeuvrable body fins was only possible after the evolution of the swimbladder. The exceptions to this design are the Birchirs, Paddlefishes and Sturgeons, which are among the most ancient and primitive of the bony fishes and still retain the larger upper lobe to the caudal fin, and some of the flying fish in which the lower lobe of the caudal fin is larger.
The reasons for the asymmetry in the early fishes, and in modern cartilaginous fish is that in these fish the fins supply all, or most of the lift to the fish's body. A fish is naturally heavier than water, even with lightweight bones other weight reducing characteristics they still have a density of around 1.076, whereas fresh water has a density of 1.0 and saltwater of about 1.026. Thus a fish will naturally sink to the sea floor if nothing stops it. If the fish is happy to live on the sea floor this is not a problem, but if it wishes to hunt nearer the surface then it has to keep making an effort to stay up.
Therefore the early fish evolved an asymmetrical tail which supplies forward momentum with the top lobe and lift with the smaller bottom lobe, which, not being stiff, flexes in counterpoint to the upper lobe, and pectoral fins that work much the way the wings of a bird or an aeroplane do. Thus the tail lifts the back of the fish and the pectoral fins lift the front. Of course the fish has to keep moving, if it takes a rest it will still sink. You will probably have noticed that sharks and rays are either moving constantly, or resting on the bottom, they do not hover in the water column.
The evolution of the swimbladder, and the neutral buoyancy it gives the fish which possess it, set fish free. They could now devote the whole of the caudal fin to propulsion and develop the pectoral and pelvic fins to maximise their manoeuvrability, thus modern fish can swim backwards, sideways, come to a complete halt, hover and turn on a dime. Abilities which have greatly increased the habitats they can take advantage of and undoubtedly contributed considerably to their being the most numerous group of vertebrates on the planet.
The fins of cartilaginous fish also differ in their basic internal anatomy from those of bony fish. The fins of all fish are supported by finrays, however in cartilaginous fish these fin rays are inflexible, unbranched and unsegmented. Whereas in bony fish they are branched, flexible and segmented, except in the ancient coelocanths whose finrays are unbranched.
Spines are associated with the fins of most fish. They are round in cross-section, stiff and unsegmented. They are an useful means of defence for a fish because they effectively increase its size without a great increase in living costs. Spines, when held stiff, make small fish much harder to swallow. In some species these spines are associated with poison glands which increases their effectiveness.
The fins of modern fish come in an amazing array of shapes and forms, however many of them can be related to the seven basic patterns depicted below.