Which solution of the wave equation (e.g., applied to the motion of a string on a violin or guitar) is realized, is due to the initial and boundary conditions, you have to apply to make the solution of the wave-equation unique. The example of the string shows that there are very many different solutions to this problem, giving rise to all the different tunes various string instruments can deliver. You can hear a pretty large variety of tunes from different string instruments. A violine produces a pretty different tone when bowed than a guitar when plugged or a piono, where a little hammer hits the string(s). Part of the different tunes are of course also due to the different form of the reonating bodies mediating the oscillations of the string to the vibrations of the air that make up the sound waves we finally hear.
So we have to think a bit about the math of the wave equation. For the 1+1-dimensional wave equation, you easily find the full solution exactly. It was already given above. I'll give the systematic derivation below. Another technique is to use Fourier decomposition, which also works in higher dimensions.
Let's set the wave velocity ##c=1## to make the notation simpler. Then the (homogeneous) wave equation reads
$$\partial_t^2 \phi-\partial_x^2 \phi=0.$$
Now from the physics problem of the string (##\phi(t,x)## is the small perpendicular displacement of a line element on the string at position ##x##) it's clear that we need the following initial conditions:
$$\phi(t=0,x)=u_0(x), \quad \dot{\phi}(t,x)=v_0(x) \quad \text{for} \quad x \in [0,L],$$
i.e., at the initial time we need to know the position and velocity of each little line element along the string of length ##L##. Further we have to state that the string is fixed at it's ends:
$$\phi(t,0)=\phi(t,L)=0$$
for all ##t##. This implies that the boundary condition must be fullfilled for the initial conditions too, i.e.,
$$u_0(0)=v_0(0)=u_0(L)=v_0(L)=0.$$
Now we introduce the new variables
$$\tau=x-t, \quad \xi=x+t.$$
One can derive, why this is a clever choice, by making use of the method of characteristics, but that's a bit complicated to explain, but you should look it up in some textbook on pde's. Here we just use that the wave equation is equivalent to the equation
$$\partial_{\tau} \partial_{\xi} \phi=0.$$
That's pretty easy to evaluate! We just have to integrate with respect to ##\tau##, which gives
$$\partial_{\xi} \phi=\tilde{f}(\xi),$$
where ##\tilde{f}## is any function. With ##f(\xi)=\int \mathrm{d} \xi \tilde{f}(\xi)## the remaining equation yields the most general solution
$$\phi=f(\xi)+g(\tau),$$
where ##f## and ##g## are arbitrary functions (which of course should be sufficiently well behaved, i.e., at least twice differentiable etc.).
Substituting back, the most general solution reads
$$\phi(t,x)=f(x+t)+g(x-t).$$
Now we have to work on the initial and boundary conditions. The initial conditions read
$$f(x)+g(x)=u_0(x), \quad f'(x)-g'(x)=v_0(x).$$
Integrating the second condition yields
$$f(x)-g(x)=\int_0^x \mathrm{d} x v_0(x):=V(x).$$
So we find
$$f(x)=\frac{1}{2} [u_0(x)+V(x)], \quad g(x)=\frac{1}{2} [u_0(x)-V(x)].$$
So the solution of the initial-value problem is
$$\phi(t,x)=\frac{1}{2} [u_0(x+t)+V(x+t)]+\frac{1}{2} [u_0(x-t)-V(x-t)].$$
Further we have to fulfill the boundary conditions
$$\phi(t,0)=0 \; \Rightarrow \; \frac{1}{2} [u_0(t)+V(t)+u_0(-t)-V(-t)].$$
This boundary condition tells us that we should continue the function ##u_0## to an odd and the function ##V## to an even function outside of the interval ##[0,L]##, where they are fixed by the initial conditions. This determines the functions ##f## and ##g## for the interval ##[-L,L]##.
Th2nd boundary condition gives
$$\phi(t,L)=0 \; \Rightarrow \; \frac{1}{2} [u_0(t+L)+V(t+L)+u_0(L-t)-V(L-t)]=0.$$
This is fulfilled by the symmetry conditions (odd and even continuation of ##u_0## and ##v_0##) under the condition that we continuate them outside of the intervall ##[-L,L]]## to be ##2L##-periodic. because then
$$u_0(t+L)+u_0(L-t)=u_0(t+L)+u_0(L-t-2L)=u_0(t+L)+u_0(-t-L)=0,$$
because ##u_0## is odd by definition. The same works for ##V##:
$$V(t+L)-V(L-t)=V(t+L)-V(L-t-2L) = V(t+L)-V(-t-L)=0,$$
because ##V## is even by construction. This solves the initial-value-boundary problem for the 1+1-dimensional wave equation completely.