the spatial eigenvalue problem
After separation, the time part T(t) is usually an easy ordinary differential equation with a clean exponential or oscillatory answer. All the real structure lives in the spatial part: an ordinary differential equation for X(x) together with the boundary conditions inherited from the problem. The catch is that this little ODE has a free number in it, the separation constant lambda — and not every lambda gives a usable answer. The spatial eigenvalue problem is the question: for WHICH values of lambda does X have a nonzero solution that also satisfies the boundary conditions?
Take X'' + lambda X = 0 on the interval 0 to L with X(0) = X(L) = 0. For most lambda the only solution obeying both ends is the boring X = 0, which gives nothing. But for special values — lambda_n = (n pi / L)^2 — a genuine wave X_n = sin(n pi x / L) fits exactly between the fixed ends. Those special lambda_n are the eigenvalues; the surviving shapes X_n are the eigenfunctions. The boundary conditions are doing the selecting: Dirichlet conditions (X zero at the ends) pick out sines; Neumann conditions (X' zero at the ends) pick out cosines; periodic conditions pick out both.
This is exactly an eigenvalue problem in the linear-algebra sense, with the differential operator playing the role of a matrix: you seek the special inputs that the operator merely scales. It explains why the modes are discrete and why a Fourier series, not an arbitrary combination, is the natural language. The deeper theory of which boundary-value problems always have a full, orthogonal family of eigenfunctions is Sturm–Liouville theory; here we just use its conclusions for the standard intervals and shapes.
Dirichlet vs Neumann on 0 < x < L: with X(0) = X(L) = 0 the eigenfunctions are sin(n pi x / L), n = 1, 2, ...; with X'(0) = X'(L) = 0 they are cos(n pi x / L), n = 0, 1, 2, ... (note n = 0 gives the constant). Same ODE, different ends, different family of modes.
The boundary conditions, not the differential equation, decide whether you get sines or cosines.
Don't forget to check lambda = 0 and lambda < 0 separately, not just lambda > 0. For Dirichlet conditions those cases give only X = 0, but for Neumann or periodic conditions lambda = 0 gives a real, non-trivial eigenfunction (the constant), which is the constant term of the series.