Utility maximization, marginal utility, and diminishing marginal utility

How do consumers (theoretically) maximize their utility over a basket of goods and services that

they consume when they have a limited budget ?