Confederations can best be described as a great alliance between multiple countries instead of between just two. Normal alliances usually work in a way that you can have alliances with multiple countries but these countries do not have to like each other - you could even be allied to two countries that are enemies. A confederation, on the other hand, has all member countries enter a mutual alliance that can differ from confederation to confederation, like a defensive only one or one where the others also join attack wars.
A confederation basically means that multiple autonomous countries - that still keep their independence and are still their own countries - create a political "group", league or whatever you want to call it. This brings all member countries much closer together and often comes with favorable trade agreements, completely open borders, sharing of research progress, financial and societal support, and other ways to work together.
Confederations are a great way for smaller countries to survive against bigger ones, especially great powers and empires. The number of member countries can differ but a confederation usually needs at least 3 members to exist. The smaller the countries the more members they usually try to find to make up for their size. However, there are still countries that would never join a confederation because they are too proud/independent, isolationistic or for other reasons. Great powers and empires usually avoid joining one as well and most confederations do not want them as members anyway since there is a danger that they could put too much pressure on the others because of their power and size. Plus, a confederation with a great power would most likely draw the attention of other great powers and empires and make them wary. This is why great powers and empires are fine with regular alliances.
A confederation can disband if too many member states have a falling out or if the confederation gets crushed and separated by force. Being in a confederation does not necessarily mean that the others will join all wars although they always come to your aid if it is a defensive war. However, if a confederation member joins a war as an ally and not the main war target they will rarely be able to call in their confederation members since it is completely up to them and most countries would not like to help a country just because one of the other members is helping them (the exception being if they like that country as well).