Butter can be used many ways in baking, depending on the result you're looking for. Cookies and cakes usually call for it to be softened, so it creams effectively with the sugar. Muffins or coffee cakes sometimes call for it to be melted and simply poured into the batter. What you need to know is that melted and softened butter behave differently in your baking -- and aren't interchangeable in most cases.
Butter is made of water, milk solids -- mostly proteins -- and butterfat. Like the cocoa butter in chocolate, butterfat isn't actually a single fat but several with different characteristics. Part of the fat crystallizes with a distinct structure, while part remains in relatively soft globules. When the butter's cold, the soft globules remain thick and sluggish, like molasses from the refrigerator. When the butter warms, they become softer and allow the crystallized fats to slide apart, becoming spreadable.
Softened butter works well during the creaming stage of your recipe. As your mixer rapidly combines the butter and sugar, the beaters themselves and the sharp corners of the sugar crystals leave trails through the butter. The globules of soft fat molecules trap the air, as whipped cream does, while the crystallized molecules provide enough structure to keep them from combining together in large bubbles. As your batter bakes, those tiny air pockets inflate with carbon dioxide gas from the baking powder or soda, and provide the final product with much of its lightness and height.
Melted butter behaves very differently from softened butter, because both the crystalline fats and the softer fats are completely liquid. For baking purposes, the butter is now a liquid fat comparable to vegetable oil, providing the crumb with richness and softness but not contributing to its structure. Baked goods made this way tend to have a relatively coarse texture, without the fine and delicate crumb of cakes made through the creaming method. In this instance, melted butter is used instead of oil because of its superior flavor.
Getting the Butter Soft
When you need softened butter for a recipe and end up with melted butter, set aside the melted version for cooking or table use, then soften more for your baking. Grate cold butter or cut it into thin slices to help it soften quickly, or speed the process by kneading it or rolling it between sheets of wax paper. Avoid using your microwave, which heats the butter unevenly and is more likely to melt it.