Indeed, a lot of the marginality conditions cannot be used directly in the presence of discrete choice levels, or fixed costs of adjustment. There are many: number of children, working or quitting, number of cars, paying the fixed cost of adjusting capital, consuming or selling durable goods, number of hours worked, workers hired, units produced, delivery trips, etc.
Marginal conditions are an approximation to reality. Economists would argue that for a plant that hires 1000 workers, we can think of the decision of hiring the 1001 worker as best though of as adding a marginal until of labor.
There are a wealth of studies into these topics: Scarf's K convexity and the S-s inventory replenishing policies, Caballero and Engel's Fixed Costs of Adjustment of Capital, etc.
A book that tries to unify some of these ideas is "The economics of inaction".
From a dynamic programming point of view, there are two useful intuitions that might help: a) In the presence of fixed costs, the firm's policy function is discontinuous and the value function is continuous and convex, but not smooth; b) the problems with fixed costs are best split into two: do I act? If I act, where do I go?
Empirical studies use this last intuition to argue that if you want to study marginally optimal capital investment decisions, you should look at situations in which firms have decided to adjust their capital level. Presumably, after paying the fixed cost of acting, firms will choose a marginally optimal policy.