One of the postulates of QM states that given a system in a state $|\psi\rangle$ and given an observable $A$ whose eigenstates are $|\phi_i\rangle$, then the state of the system can be expressed as a linear combination of them such that
and the probability of the eigenvalue $a_i$ associated to the eigenstate $|\phi_i\rangle$ of coming out when $A$ is measured is determined by $|c_i|^2$.
So far so good. My question is how are the $c_i$ coefficients determined. I mean, if one can only get eigenvalues when doing measurements, and on top of that the system is left on an eigenstate right after that, how can one know the state in which the system is before performing the measurement (and, with that, the probability of getting the different eigenvalues)?