Least squares solves $\min_x\|Ax-b\|_2$. A minimizer always exists in finite dimensions, and its fitted vector $A\hat x$ is the orthogonal projection of $b$ onto $\operatorname{Col}A$. The residual is orthogonal to all columns, yielding $A^*(A\hat x-b)=0$. Coefficients are unique exactly when $A$ has full column rank.