Looking at the list of nations to declare on Germany there's a large number of declarations in '44-'45 from countries that hadn't and wouldn't take any serious actions in the war (Turkey, Liberia, Ecuador, etc.) What pushed these countries to declare and what benefits, if any, did they or the allies expect to gain from these declarations?
Thank you for your time
Turkey spent much of the war trying to ensure a very delicate balance between the Axis and the Allies. Before the War, Turkey was allied with the British and the French by a set of treaties, meant as a precaution against potential Italian aggression. When the war broke out, Turkey did its best to avoid actually entering the war. Especially when Germany seemed to be on course to victory, İnönü government made sure to enjoy good relations with the Germans, who in turn did not threaten Turkey directly even after their invasion of the Balkans. Germans could have overrun Turkey but they did not; Turkey could have join the Allies and stop shipping precious metals to Germany but it did not. All this while not burning the bridges with the Allies. When the tide turned around 1943, Turkey's relations with Germany started to deteriorate. Again, however, the government resisted entering the war. Basically, they required additional financial and logistics support from the Allies; when this was granted at least partially, they found different reasons to avoid partaking in the conflict directly. By the end of 1944 though, it was clear that Turkey was on the Allies' side, despite still remaining reluctant to host Allied troops in the country or participate actively.
What changed the situation at the very end of the war is twofold. First, the attitude of the USSR. The Turco-Russian Treaty of Friendship and Neutrality was to expire in 1945 (signed twenty years ago) and the USSR made it known that they had no intention to renew the treaty. Stalin was reportedly angry with the Turkish attitude throughout the war, when the Turks rejected opening a new front in the Balkans against the Germans and resisted joining the war effort at all times. Furthermore, there were also increasingly reliable news that the USSR demanded a few provinces (perhaps even more, according to some) of Turkey near Armenia and Georgia, provinces of Kars and Ardahan for instance that had long been a battleground of Russian, Armenian, and Ottoman/Turkish forces. This was unacceptable and İnönü government quickly realised that there was no way they could stop the USSR from invading Turkey by themselves. Western support, especially American, was needed. Some people contest that the USSR really wanted Turkey to cede provinces, but the scholarly consensus to my knowledge is that they either did want it or seriously considered it and used this to corner Turkey. In either case, enough to cause Turkey to look alliances elsewhere. Part of the territory claims stemmed from newspapers in the USSR, from articles written by Soviet academicians, and considering the scientific independence and freedom of press found in the USSR, Hasanli argues (rightly, I think) these could not but be intended to be seen by Turkish eyes by Soviet authorities. They also had demands about the Turkish straits; a nightmare Turkey had hoped to have been all concluded by the Treaty of Montreux in 1936.
This brings us to the second issue. How to have good relations with the US and the West? The best way was to ensure a seat at the United Nations, especially considering how much Americans emphasised this as a gadget for building a new world. The problem is that, in order to join the UN, a country had to declare war on the Axis (Luard, p. 39). Hence the declaration of war. Reading Luard, I get the impression that the reason others declared war on Germany and Japan was probably the same: the intention to establish a place for oneself in the new world. In Turkey's case, the great difference is the troubles with the Soviets.
This was a bit late but I hope it helps you!
Sources:
Evan Luard, A History of the United Nations: The Years of Western Domination, 1945-1955 (London and Basingstoke: Macmillan, 1982).
Jamil Hasanli, Stalin and the Turkish Crisis of the Cold War: 1945-1953 (Lanham, MD: Lexington, 2011).