The complexity informs us about the complexity of the algorithm, which in this case would be the most general one (Schoolbook matrix multiplication).
Say that you have two general matrices $A (m\times n)$ and $B (n\times p)$, then the product matrix $C=AB$ is computed with:
$$ c_{ij} = \sum_{k=1}^n a_{ik} \times b_{kj} $$
If you know nothing about $A$ and $B$, then the complexity can be no better than $O(mnp)$, because we have $mp$ elements in the $C$ matrix, which each took $n$ products.
Q1. To answer your question, if you have $Y=X^TSX$, and no more information about $S$, then we can analyze the formula to figure out the complexity:
$$ y_{ij} = \sum_{k=1}^N \sum_{l=1}^N x_{ki}\times s_{kl}\times x_{lj}$$
so in this case the complexity for $Y$ would be $O(D^2\times N^2 \times 2)$, because we have $D^2$ elements, with two $N$-sums of $2$ products each. The complexity could be lower if you stored the intermediate matrix product, instead of recomputing for each pair $(i,j)$. For example, one can precompute the matrix $(SX)_{k,j}$, whose values will be reused for the matrix-vector multiplications in the rest of the product: $\sum_{k=1}^N x_{ki}\times (SX)_{kj} $. This would yield a complexity of $O(DN(D+N))$, as user7530 explained.
Q2. With the formula above, the answer to your last question is straightforward. If $S$ is diagonal, then we are only interested in the $s_{kk}$ elements, which would cancel one of the sums, and factoring out the $s_{kk}$ term:
$$ y_{ij} = \sum_{k=1}^N x_{ki}\times s_{kk}\times x_{kj}$$
with complexity $O(D^2\times N \times 2)$. If you know more about $X$, you can further simplify your product.