rational cohomology of finite real grassmannian
I could not find the explicit formulas in the Algebraic models book (they seem to only do infinite Grassmannians and Stiefel varieties) or Mimura-Toda (they do the complex and symplectic case but not the orthogonal one). Generally, I found it annoyingly difficult to dig up explicit formulas and simple explanations in the literature. So, as a service for those who feel the same way, I provide a short discussion of the rational cohomology of real Grassmannians here and apologize for bouncing an old question on which the dust had already settled.
The main point (for understanding why cohomology of Grassmannians is the way it is) is to note that the homogeneous space description of the Grassmannians as ${\rm O}(n)/{\rm O}(k)\times{\rm O}(n-k)$ implies that there is a fiber bundle $$ {\rm Gr}_k(\mathbb{R}^n)\to {\rm BO}(k)\times{\rm BO}(n-k)\to{\rm BO}(n), $$ which can be interpreted as saying that the Grassmannian is the universal space with a pair of real vector bundles $(\mathcal{E},\mathcal{F})$ of ranks $k$ and $n-k$, respectively, such that $\mathcal{E}\oplus\mathcal{F}$ is the trivial rank $n$ bundle. The classifying map ${\rm Gr}_k(\mathbb{R}^n)\to {\rm BO}(k)\times{\rm BO}(n-k)$ induces a homomorphism $$ {\rm H}^\bullet({\rm BO}(k)\times{\rm BO}(n-k),\mathbb{Q})\to {\rm H}^\bullet({\rm Gr}_k(\mathbb{R}^n),\mathbb{Q}) $$ and so we get two sets of characteristic classes: the Pontryagin classes $p_i$ for $\mathcal{E}$ and the Pontryagin classes $\overline{p}_i$ for $\mathcal{F}$. Moreover, since $\mathcal{E}\oplus\mathcal{F}$ is trivial, there is a natural relation $p\cdot\overline{p}=1$ for the product of total Pontryagin classes (this is essentially the Whitney sum formula). The main result is then that for the even-dimensional Grassmannians this is already the description: $$ {\rm H}^\bullet({\rm Gr}_{2k}(\mathbb{R}^{2n}),\mathbb{Q})\cong {\rm H}^\bullet({\rm Gr}_{2k}(\mathbb{R}^{2n+1}),\mathbb{Q})\cong {\rm H}^\bullet({\rm Gr}_{2k+1}(\mathbb{R}^{2n+1}),\mathbb{Q})\cong \mathbb{Q}[p_1,\dots,p_k,\overline{p}_1,\dots,\overline{p}_{n-k}]/(p\cdot\overline{p}=1). $$ (Note that the Euler classes don't appear here: we are talking about the non-oriented Grassmannians and therefore the Euler classes naturally live in cohomology with twisted coefficients; they appear when passing to the oriented Grassmannians.)
For the odd-dimensional Grassmannians, there is an additional class $r$ in degree $2n+1$: $$ {\rm H}^\bullet({\rm Gr}_{2k+1}(\mathbb{R}^{2n+2}),\mathbb{Q})\cong \mathbb{Q}[p_1,\dots,p_k,\overline{p}_1,\dots,\overline{p}_{n-k},r]/(p\cdot \overline{p}=1,r^2=0). $$ The class $r$ is detected after pullback along ${\rm O}(2n+2)\to{\rm Gr}_{2k+1}(\mathbb{R}^{2n+2})$, it's not in the image of ${\rm H}^\bullet({\rm BO}(k)\times{\rm BO}(n-k),\mathbb{Q})$.
As far as I understand, the results for the even-dimensional Grassmannians were first proved by Borel, the results for the odd-dimensional ones by Takeuchi.
A. Borel. Sur la cohomologie des espaces fibre principaux et des espaces homogenes de groupes de Lie compacts. Ann of Math (2) 57 (1953), 115-207.
M. Takeuchi. On Pontryagin classes of compact symmetric spaces. J. Fac. Sci. Univ. Tokyo Sect I 9 (1962), 313-328.
The results were also proved by He (arXiv paper here), Carlson (arXiv paper here), Sadykov (paper in PJM here) and probably I am missing some other references...
In the monography "Algebraic models in geometry" by Félix, Oprea and Tanré look at section 1.12.
And also: Mimura, Mamoru and Toda, Hirosi (1991). Topology of Lie Groups. I, II, Volume 91 of Translations of Mathematical Mono- graphs. American Mathematical Society, Providence, RI.