I have checked the other related posts (see 1 and 2), but it didn't solve my problem which is explained below:
Consider three simple sine waves as follows:
$$ x_{1}=a_{1} \sin \left (\omega_{1} t+\phi_{1} \right ) \\ x_{2}=a_{2} \sin \left (\omega_{2} t+\phi_{2} \right ) \\ x_{3}=a_{3} \sin \left (\omega_{3} t+\phi_{3} \right ) $$ where $x_{i}$ is the instantaneous value of the corresponding signal, $a_{i}, \omega_{i}$ and $\phi_{i}$ are the amplitude, frequency and phase respectively.
If I add these three waves, I will get
$x=x_{1}+x_{2}+x_{3}$
How can I get back the amplitude, frequency and phase values of the component signals from $x$?
Consider the Fourier transform of $x(t)$, let us call it $X(\omega)$. Since the Fourier transform is linear and $x(t) = x_1(t)+x_2(t)+x_3(t)$ we have $X(\omega)=X_1(\omega)+X_2(\omega)+X_3(\omega)$. For $x_i(t) = a_i \sin(\omega_i \cdot t + \phi_i)$ we have $X_i(\omega) = \jmath \pi a_i \left(\delta(\omega+\omega_i)- \delta(\omega-\omega_i)\right)$ where $\delta(\omega)$ is the Dirac delta "function". Therefore, the Fourier transform of $x(t)$ is given by $$X(\omega) = \sum_{i=1}^3 \jmath \pi a_i {\rm e}^{\jmath \phi_i}\left(\delta(\omega+\omega_i)- \delta(\omega-\omega_i)\right).$$ Therefore, if the frequencies are distinct, in theory all you have to do is to find the delta "peaks" in the spectrum. Their location will tell you the frequencies $\omega_i$, their complex amplitude will give $a_i$ (magnitude) and $\phi_i$ (phase).
Of course in practice we are usually faced with the situation that we do not have the entire function $x(t)$ available but only a limited number of samples of $x(t)$. In this case, the problem is called harmonic retrieval and has been very well studied in the literature. There are non-parametric ("low resolution") schemes based on the DFT (which can identify frequencies only if they are separated by more than one over the observation window) as well as parametric schemes that achieve a resolution that is only limited by the amount of additive noise (look for things like Capons method, Prony method, the MUSIC algorithm, ESPRIT). Alternatively, you can always use a maximum likelihood estimator. Such methods should be covered in most textbooks on digital signal processing.
If the frequencies are not distinct, the problem does not have a unique solution, see John's answer.