Consumer optimum in an economy with a continuum of commodities
As the OP noted in a comment, Theorem 1 in section 12 of Kolomogorov and Fomin's Calculus of Variations seems to provide some comfort that we can indeed use the Langrange Multiplier method when the number of our variables is infinite. Still, the authors do that in a footnote, writing "the reader will easily recognize the analogy with Langrange multipliers". So no, this does not rigorously show what we want.  

I think that what we need is a paper like Craven, B. D. (1970). A generalization of Lagrange multipliers. Bulletin of the Australian Mathematical Society, 3(03), 353-362. which in its summary writes:


  The method of Lagrange multipliers for solving a constrained
  stationary-value problem is generalized to allow the functions to take
  values in arbitrary Banach spaces (over the real field). The set of
  Lagrange multipliers in a finite-dimensional problem is shown to be
  replaced by a continuous linear mapping between the relevant Banach
  spaces.


This is math-speak but it says what we wanted to hear (one can also find a short exposition in wikipedia to the degree that it trusts the content).  

Then, we can form the Lagrangean of the problem

$$\Lambda = \int_0^1 c_i^\theta\,\text{d}i +\lambda\left(M - \int_0^1 p_i c_i\,\text{d}i\right)$$

and calculate the first-order condition(s) by , informally speaking, "looking at the integral and seeing a sum",

$$\frac{\partial \Lambda}{\partial c_i} = 0 \Rightarrow  \theta c_i^{\theta-1} = \lambda p_i, \;\; i \in [0,1] \tag{1}$$

...a continuum of conditions. For later use we  define

$$\sigma \equiv 1/(1-\theta), \Rightarrow 1-\theta = 1/\sigma, \;\; \theta = \frac {\sigma-1}{\sigma}$$

The constant $\sigma$ can be shown to be the elasticity of substitution between any two goods.

Writing $(1)$ for commodity $j$ and equating through the common lagrange multiplier we arrive at 

$$c_i = \left(\frac {p_i}{p_j}\right)^{-\sigma}c_j
 \tag{2}$$

Multiply both sides by $p_i$ and take the integral over the commmodity space with respect to $i$:

$$\int_0^1 p_i c_i\,\text{d}i = \int_0^1 p_i^{1-\sigma}p_j^{-\sigma}c_j\,\text{d}i$$

$$\Rightarrow M = p_j^{\sigma}c_j\int_0^1 p_i^{1-\sigma}\,\text{d}i$$

$$\Rightarrow c_j = p_j^{-\sigma} \cdot M \cdot \left(\int_0^1 p_i^{1-\sigma}\,\text{d}i\right)^{-1} \tag{3}$$

which is Marshallian demand for commodity $j$.