I see solutions to problems on this site and in quiz solutions where the question is regarding the ırreducibility of a polynomial over $\Bbb Q$ and the answer is obtained by testing irreducibility over $\Bbb Z_2[x]$ or $\Bbb Z_3[x]$. I don't understand how testing over the latter fields yields anything for $\Bbb Q$.
Another question is regarding how a polynomial can be reducible over $\Bbb Z$ and $\Bbb R$, but not $\Bbb Q$. If it's reducible over $\Bbb Z$, shouldn't it be reducible over $\Bbb Q$ as well?
As to your first question, if $f(x)=g(x)h(x)$ (with all polynomials in $\Bbb Z[x]$), then also $f(x)\equiv g(x)h(x) \pmod{p}$ for any prime $p$. In other words, if you can factor $f$ over $\Bbb Z$, then you necessarily can always factor $f$ over $\Bbb Z_p$. Taking the contrapositive, if for any $p$ you can't factor $f$ over $\Bbb Z_p$, then $f$ must be irreducible over $\Bbb Z$ as well.
You are correct that a polynomial that is reducible over $\Bbb Z$ is necessarily also reducible over $\Bbb Q$. However, $x^2-2$ is irreducible over $\Bbb Q$ but reducible over $\Bbb R$ (as $f(x) = (x- \sqrt 2)(x + \sqrt 2).$)