To aggregate individual demands to the the market demand curve for a rival good one
(a) Sums horizontally, i.e., for each marginal willingness to pay one adds up the quantities each individual is willing to buy.
(b) Sums vertically, i.e., for each quantity one adds up the marginal willingness to pay of each individual.