Battle axes were still in wide use until gunpowder tactics started to dominate warfare. What advantages did they have over other conventional weapons such as swords, spears and hammers which appear to be more versatile and perhaps better tools for the specific uses an axe had. Would it not be more prevalent to employ the use of axes in more specialised circumstances?
This is more of a martial arts question than a strictly historical one. Unfortunately, historical chroniclers weren't particularly big on the "why" of many armaments, and axes reach the height of their popularity in Europe when the production and/or acquisition of a book is difficult, laborious, and expensive. As a result, the martial answers you're looking for are necessarily interpretive, although they can be informed and combined with more solidly historical information.
In any case, there are various reasons to use an axe over another weapon. One is economical; an axe contains less iron or steel than a sword, making it cheaper to produce on the basis of raw materials, with less labour involved in the fashioning of the blade. In earlier medieval societies, this is arguably the biggest driving force behind the popularity of the one-handed battle axe. Additionally, the large, round infantry shields popular in many tribal and post-tribal Germanic societies synergises well with such an axe, as the shield nullifies the defensive weaknesses of said axes. That's a very short primer on the battle axe as an earlier medieval weapon of war, but you asked about later axes. To discuss those properly, you have to understand how an axe works relative to a sword or polearm.
Axes belong to a family of weapons sometimes referred to as "mass weapons", in the sense that they have a heavy weight on one end in order to focus the impact force of a blow. Clubs, maces, hammers and axes all work by this principle and are very similar weapons in terms of use. The differences mostly deal with the kind of injury or threat one wants to deliver; an axe has a cutting edge, a mace has blunt flanges, and a hammer has a piercing spike facing, but each of them is going to handle in a similar fashion and employ similar techniques and strategies. The way the weight of something like a sword is distributed is almost the opposite; the ideal point of balance for a sword varies by design, but is generally a few inches up the blade from where the dominant hand holds the grip. This means that the heaviest part of a sword (or where the sense of weight concentrates) is near to the hand and can be manipulated more easily. The equivalent point on an axe is at the very end of the object.
The additional length and control of a sword makes it superior to an axe in terms of maintaining defense, especially in conjunction with technique. Most surviving or reconstructed fencing styles instruct their users to keep the point of the sword trained upon their opponent when their opponent is within range to hit them; this establishes both a physical barrier (the extension of the sword closes off multiple lines of attack) and a psychological one (because the point of a sword is in a person's face). This is true of kendo and kenjutsu in Japan, plus just about every known tradition from Europe. Keep in mind that modern knowledge of European fencing begins in the 13th century with the MI.33 "Tower" manuscript teaching sword & buckler, continuing on to present day sport fencing. To some degree, everything from the Liechtenauer tradition of medieval Germany to the Scottish stylings of Page and the English swordplay of Silver adheres to this. The degree alters, but it's a fundamental, if mutable, rule of survival.
Most axes do not at all benefit from this rule. Without a point to threaten an opponent, and generally lacking the length to establish a strong defense with their independent physical characteristics, the use of a basic axe without additional protection leaves one vulnerable. So why didn't axes die out during the Renaissance, an era where a general absence of shields, commonality of at least partial plate harness, and the increasing relevance of handheld firearms made swords both ideal and accessible sidearms?
They adapted, becoming part of hybrid weapons. By the time the Renaissance rolls around, single-handed battle axes have become very uncommon. At this stage, they're usually used as a matter of preference by some mounted knights, taking full advantage of the impact force that can be generated from horseback to compound the natural impact force of the axe. This allows single-handed axes to connect with much more power than their earlier medieval equivalents, which were almost strictly foot weapons. That's a fringe application of axes in such a late context, though, as most axes blades can be found on the end of very long sticks.
The Swiss are famous for their halberds, which are probably the most notorious late medieval/Renaissance-era axelike weapons. Poleaxes, similar weapons with less length and arguably more robust construction, were popular among knights when they were required to fight on foot. Then there's the English bill, an utter mainstay of English men-at-arms during the late Middle Ages. Overwhelmingly, the strengths of the by now antiquated battle axe are now expressed in maces and hammers, or in multifaceted polearms. Remember that the axe belongs to the aforementioned "mass weapon" category, so the difference between an axe and a mace can be considered much like the difference between a straight sword and a curved one; similar concepts are applied with different executions to match the requirements of the context.
The use of axe blades on polearms has one final, significant advantage; they can harness some of the defensive capabilities I attributed to swords above. With a length that far exceeds most swords, axe-bladed polearms can establish a strong defense while threatening the opponent with both the thrusts of blades or top-spikes, and the impact cuts of axe heads, hammer facings, spikes, and other nasty implements. As a result, weapons such as the bill, halberd and poleaxe become overwhelmingly favoured by infantry in field battles, being advancements of both spear and axe technologies.