Cake texture depends on the right balance of sugar, fat, eggs, and liquid (e.g. milk) in the recipe:
Sugar: it does more than sweeten. It locks in moisture, keeping the cake fresh longer, and has an impact on the volume and the color of the cake.
Fat: ingredients like butter or oil coat the flour, preventing the cake from becoming tough and creating a tender crumb.
Air: proper mixing (creaming) traps air bubbles, which expand in the oven to make the cake light and fluffy.