What exactly were they, just a league of merchant guilds, or some other type of political entity? How did they operate amongst all of the Kingdoms and countries in the area while still having power? And how much power did they have?
The Hanseatic League were prominently a league of merchant guilds centered around the city of Lubeck that operated in the Baltic from the 14th century to the 17th century. Regarding the political structure of the league, the league appears more to be a confederation of merchants seeking to protect their common interests rather than being a political entity in its own right. I would say its political power was somewhat similar to the British East India Company in that while the company has not a de jure political entity in its own, the company still had the capability to wage war in its own right and at its height had de facto control over most of India.
Of course, the league did not have actual political control over the Baltic, but its influence was considerable and did manage to successfully wage naval wars against both pirates and monarchical states like Sweden and Denmark. The the main part league itself was a de jure part of the Holy Roman Empire, though some Haneatic cities were part of other entities like the Teutonic Order or Kingdoms like Poland the Sweden. Regrading Lubeck, the HRE had little influence over it given that Lubeck was an Imperial Free City meaning that the city was essentially self-governing and was represented in the Imperial Diet, though still under the protection of the emperor. As for the league's control over Lubeck itself, I would say that while the league did not rule Lubeck directly, it most certainly had the greatest influence and probably had de facto control over the city similar to how the merchant guilds had de facto control over Genoa, another example of a city under Holy Roman control that had a great deal of independent influence extended predominantly by independent merchants.
The way the League worked was to establish Kontors or trading posts outside of this core cities similar to how both Venice and Genoa used Galatia outside Constantinople. The main cities were divided into four quarters to increase collaboration and interdependence amongst the cities. These quarters were the Wendish headed by Lubeck itself, the Baltic, centered around Gdansk (also known as Danzig), the Westphalian centered around Cologne, and the Saxon centered around Magdeburg.