How does one obtain observables from a wave function? I'm beginning to study the quantum chemistry (my background is computer science and computational mathematics) and I'm not sure if I understand well the basic concepts, like wave function and operators.
I've read questions
What is a wave function in simple language?
Use of Operators in Quantum Mechanics,
and I understood that the wave function describes all the observable quantities of a system, e.g. an electron.
But what should I do when I want to obtain some of these quantities? Let's say I want to obtain spin and momentum. If I use the linearity property of quantum operators, $\hat{O}$ being the operator, $o$ its eigenvalue and $\psi$ the wave function, like this
$$\hat{O}\psi = o\psi$$
does $o$ always equal the observable value? In other words, is it enough to use the above equation and express the $o$ variable to get an arbitrary observable value?
 A: $\hat{O}$ will have a set of eigenvectors $\phi_i$ and eigenvalues $o_i$.
You can expand your wave-function $\psi$ in terms of the basis set $\phi_i$, i.e. $\psi=\sum_i c_i\phi_i$.
If you make a single measurement then your wave-function $\psi$ will collapse to one of the eigenvectors $\phi_i$ with probability $|c_i|^2$ in which case your measurement is the corresponding eigenvalue $o_i$.
In many cases we are interested in the average rather than a single measurement, in which case you evaluate
$$ \langle\psi|\hat{O}|\psi\rangle = \sum_i |c_i|^2o_i $$
A: Just think of the operators and states in terms of linear algebra.
Correspondence between q.m. and linear algebra:
The operators $\hat O$ correspond to the matrices, the wave function $\psi$ corresponds to the vectors, and the the so called expectation values $\langle \psi|\hat O |\psi\rangle$ of the matrix are the possible outcomes of the measurement. Here, what I mean by this:


*

*The operators $\hat O$ describe the quantity, which we like to measure. E.g. if we are interested in the energy of a system, we use the Hamilton operator $\hat O = \hat H$, but if we like to measure the spin of a quantum system, we would use $\hat O = \hat S$.

*The wave function represents the state of the quantum system. It is similar to a vector in linear algebra. Therefore, your statement


I understood that the wave function describes all the observable quantities of a system, e.g. an electron. 

is not true.


*

*The expectation value are the possible outcomes of a measurement.  However, if  the quantum system is in an eigenstate $\psi_i$ of that particular operator, the calculation becomes very simple: the possible outcomes of an experiment are just the eigenvalues $o$ of the operator. However, in general a quantum system will not be in an eigenstate of the operator of interest. However, as in linear algebra, we can express any state as a superposition of different eigenstates. Then the calculation becomes rather simple. 


For example: Suppose we want to measure the spin of an electron with respect to the $z$-axis. As a matter of fact, the spin operator of an electron $\hat S_z$ has only two eigenstates, which we denote by $|+\rangle$ and $|-\rangle$. Suppose the electron is in the state $|\psi\rangle$ (which is equivalent to the wave function $\psi$).


*

*Decompose the state $|\psi\rangle$ into the eigenstates of the spin operator $$ |\psi\rangle = c_+ |+\rangle + c_-|-\rangle$$ where the two coefficients are just the projections $c_+ = \langle +|\psi\rangle$ and $c_- = \langle -|\psi\rangle$.

*Now calc the expectation value: 
\begin{align}
\langle \psi|\hat S_z |\psi\rangle &= \big(c_+^* \langle +| + c_-^*\langle -| \big) \; \hat S_z  \; \big(c_+ |+\rangle + c_-|-\rangle \big)\\ 
 & = ... \\
 &= s_+|c_+|^2 + s_-|c_-|^2 
\end{align}
where $s_\pm$ are the two eigenvalues of $\hat S_z$.

A: 
But what should I do when I want to obtain some of these quantities?

In general, the wavefunction encodes the probability amplitudes for a particular value of an observable to be measured.  Only in the special case that the wavefunction corresponds to an eigenstate of the observable can one 'obtain the quantity' $o$ by operating on the wavefunction with the observable $\hat O$.
That is to say, it is not generally the case that
$$\hat O \psi = o \psi$$
Generally, operating on a wavefunction with an observable yields a different wavefunction:
$$\psi' = \hat O \psi$$
where $\psi'$ is not a scaled version of $\psi$.  This means that the system is not in a state with a definite value for the observable $\hat O$, i.e., the state is a superposition of states with definite values for the observable $\hat O$.
For example, consider the superposition of two wavefunctions that correspond to eigenstates of $\hat O$:
$$\psi = \frac{1}{\sqrt{2}}(\psi_1 + \psi_2)$$
where
$$\hat O \psi_1 = o_1 \psi_1\,\quad\hat O \psi_2 = o_2 \psi_2,\quad o_1 \ne o_2 $$
Then
$$\hat O \psi = \frac{1}{\sqrt{2}}(o_1 \psi_1 + o_2 \psi_2) \ne o\psi$$
So, $\psi$ does not have a definite value for the observable $\hat O$ and, from this wavefunction, we can only calculate the probability of measuring $o_1$ or $o_2$.  For that, we use the fact that eigenstates of an observable are orthogonal to 'project out' the associated eigenstate.  Using abstract ket notation, the probability amplitude to measure the value $o_1$ is
$$\langle \psi_1|\psi\rangle = \frac{1}{\sqrt{2}}(\langle \psi_1|\psi_1\rangle + \langle \psi_1|\psi_2\rangle) = \frac{1}{\sqrt{2}}(1 + 0) = \frac{1}{\sqrt{2}}$$
The probability is the modulus squared of the probability amplitude and so the probability of measuring $o_1$ is $1/2$.
A: Usually the procedure is the other way around, i.e. one starts with the observables and then (if there are sufficiently many commuting observable) one constructs  eigenstates of the operators corresponding to the observables.  A wavefunction will then be some combination of the eigenstates specified by the initial conditions of the problem.
Since the eigenvalues of the operators play the role of labels for the eigenstates, the choice of observables is often dictated by the physics of the problem.  The energy is an important quantity; the corresponding operator is the Hamiltonian so one usually constructs states that are eigenstates of the Hamiltonian.  For 1d problem this is enough.
For 2d or 3d problems one must look for additional observables.  In the case of a 3d spherically symmetric potential, those additional observables are the square of the angular momentum operator $\vec L\cdot \vec L$ (with operator $\hat L^2$) and one component of the angular momentum, usually $L_z$ (with operator $\hat L_z$).   Any other component of $\vec L$ would work but spherical coordinates "single out" the $\hat z$ component as having a particularly simple expression $L_z=L\cos\theta$ so this choice is the more common.  In more mathematical terms:
\begin{align}
\hat H\psi_{n\ell m}(r,\theta,\phi)&=E_{n,\ell}\psi_{n\ell m}(r,\theta,\phi)\, , \\
\hat L^2\psi_{n\ell m}(r,\theta,\phi)&=\hbar^2\ell(\ell+1)\psi_{n\ell m}(r,\theta,\phi)\, , \\
\hat L_z\psi_{n\ell m}(r,\theta,\phi)&=\hbar m \psi_{n\ell m}(r,\theta,\phi)\, .
\end{align}
Note that $E, \hbar^2\ell(\ell+1)$ and $\hbar m$ are number (eigenvalues in fact), not observables.
There are of course other observables in your system: $L_y$ and $L_x$ are obvious, but one can think of various other combinations of $p_k$'s and $q_j$'s.  However, in general, for observables ${\cal O}$ other than $E$, $\vec L\cdot\vec L$ or $L_z$
$$
\hat {\cal O}\psi_{n\ell m}(r,\theta,\phi)\ne o\,\psi_{n\ell m}(r,\theta,\phi)\, , \tag{1}
$$
but it still makes sense to compute average values and matrix elements, such as
$$
\langle {\cal O}\rangle = \int dV \psi^*_{n\ell m}(r,\theta,\phi)\hat{\cal O}\psi_{n\ell m}(r,\theta,\phi)
$$
(There are exceptions to (1) if you can find observables that commute with the above three, but this does not always happen.)
Nevertheless, you can verify that in systems with spherically symmetric potentials, the basis functions are usually eigenstates of the energy, the magnitude of the angular momentum, and the $z$-component of angular momentum.  These three observables commute and are enough to completely specify an eigenstate.  Moreover, they form a complete set of commuting observables, meaning that any wavefunction can be expanded as a linear combinations of eigenstates of these operators.
If you choose to include spin, then this set of observable is no longer complete, and you need to include spin operators to completely specify eigenstates.
