Why torsion is important in (co)homology ?  I've once been told that "torsion in homology and cohomology is regarded by topologists as a very deep and important phenomenon". I presume an analogous statement could be said in the context of algebraic geometry.
In this community wiki question I would like to gather examples, in geometrical fields such as algebraic topology and algebraic geometry, of phenomena that manifest themselves by the presence of torsion in (co)homology groups and whose trace is consistently lost if we simply disregard the torsion part of those groups. 
As guidelines for the answers:

Which kind of information is lost disregarding torsion in (co)homology? (provide examples)
What does the torsion part of (co)homology tell us about the geometric object involved? 
  (provide examples)

Here "(co)homology" should be understood in any relevant sense, from singular cohomology of cw complexes to étale cohomology of algebraic varieties and so on and so forth. 
It may well be true that the algebro geometric examples have nothing to do, conceptually, with the topological ones: I'm not interested in a unifying pattern per se, but if such a unifying pattern does appear in some answers, well, it's just good.
 A: Inspired by Ulrich Pennig's answer, I'll mention that Chern-Weil theory tells us that the Chern classes of a flat bundle over a manifold are always trivial in rational cohomology.  But quite often they are non-trivial in integral cohomology, and hence provide a method of distinguishing between flat bundles.  For instance, over a non-orientable surface, there are precisely two isomorphism types of flat vector bundles in each dimension (one being the trivial bundle), distinguished by their first Chern class in $H^2 (S; \mathbb{Z}) = \mathbb{Z}/2$.
A: Integer Pontrjagin classes are diffeomorphism invariant, while rational Pontrjagin classes are homeomorphism invariant, due to Novikov. Also there are examples where two smooth manifolds are  homeomorphic but with different integer Pontrjagin classes. And of course the cohomology of the manifolds need to have some torsion in order to make this work. See for example, Matthias Kreck and Wolfgang Lück's 2005 book, The Novikov Conjecture: Geometry and Algebra, (https://doi.org/10.1007/b137100) pp. 29–31.
A: Following up on Charles' comment to Kevin's answer, torsion can be helpful in determining whether or not a manifold is orientable: $H_{n-1} (M; Z)$ is torsion-free when M is orientable and has torsion subgroup Z/2 when M is non-orientable. For surfaces, this means orientability can be detected from H_1, which is quite nice.  
On the other hand, you don't really need to pay attention to torsion to see the difference between orientability and non-orientability.  A closed (connected) n-manifold M is orientable iff $H_n (M; Z) = Z$, and non-orientable iff $H_n (M; Z) = 0$.  The same statements hold with integral coefficients replaced by real coeffients.
This is all in Hatcher's section on Poincare Duality.
A: The following is an example of how torsion is used in the theory of 3-manifolds.
It is a theorem of Thurston that there are infinitely many non isometric compact hyperbolic 3-dimensional manifolds of uniformly bounded volume (this is obvious in dimension 2 and false in higher dimensions).
Probably the easiest way to see it is by constructing an infinite collection of compact hyperbolic 3-dimensional manifolds of uniformly bounded volume with pairwise different $H_1(\cdot,\mathbb{Z})$.
Note that by a theorem of Gromov the betti numbers of a compact hyperbolic 3-dimensional manifolds are bounded by means of their volumes, hence the difference is really in the torsion part of the homology.
The actual construction of the collection is as follows: fix a figure 8 knot in $S^3$, drill a tubular neighborhood of it (which is a fat torus) and glue it back using an arbitrary identification of the torus boundaries (of the fat torus and its complement). This process is known as "Dehn surgery". Computing the homology of the constructed manifold is easy using Mayer-Vietoris LES. The non-trivial parts in Thurston's proof are the facts that (for almost all gluing procedures) you get a hyperbolic manifold and its volume is indeed uniformly bounded. 
A: An orientable closed 3-manifold $M$ with $rank(H_1(M,\mathbb{Z}/p\mathbb{Z}))\geq 3$ has infinite fundamental group, by a result of Shalen & Wagreich (one may also deduce this now from the Geometrization theorem, but their theorem gives more information, such as the $p$-completion of $\pi_1(M)$ is infinite). Of course, if $b_1(M)=0$, then this is undetected by rational cohomology. 
A: Suppose $G$ is a split semisimple $\mathbf{Q}$-group and $\Gamma \subset G(\mathbf{Q})$ is a lattice.  Conjectures due to Ash and his collaborators (elaborating on earlier work of Serre) predict a fairly precise correspondence between continuous representations $\rho: \mathrm{Gal}(\overline{\mathbf{Q}}/\mathbf{Q})\to\widehat{G}(\overline{\mathbf{F}}_p)$ and "Hecke eigenclasses" in $H^{\ast}(\Gamma,\overline{\mathbf{F}}_p)$.  See for example this paper where the conjecture is elaborated very precisely for $\mathrm{GL}_n/\mathbf{Q}$, and this paper for a more general prediction.
The really remarkable thing here is that for may groups $G$ - say, if $G(\mathbf{R})$ does not admit discrete series - there should be a serious paucity of non-torsion characteristic zero homology, and the classes predicted by Galois representations will often not be the mod-$p$ reduction of some characteristic zero class!  So these genuine torsion classes should be tied rather intimately to Galois representations - that seems pretty remarkable to me!
A: The Hantsche obstruction to embedding a 3-manifold $M$ in a homology 4-sphere is a $\mathbb Q/\mathbb Z$-valued bilinear form on the torsion subgroup of $H_1(M;\mathbb Z)$. If you were to use (co)homology with rational coefficients this would be invisible to you. 
If you're less fussy about using the integers in your discussion of torsion, the Alexander polynomial is a torsion invariant of the homology of a covering space of knots and links. This time the ring is the ring of single-variable Laurent polynomials with integer coefficients.
A: In his seminal work on the topology of Lie groups, Armand Borel discovered a connection between odd torsion in the integral homology of simply connected compact Lie groups and the failure of the homology Hopf algebra to be commutative.
Borel's observation led to work of William Browder, and Alex Zabrodsky tracing the issue back to homotopy associativity of the multiplication.  One nice result,due to Richard Kane, is that if p is an odd prime and there is p-torsion in the integral homology of a simply connected finite H-space admitting a homotopy associative multiplication,then the rank is at least 2p-2.  The same conclusion can be stated for p-localizations or p-completions.
A: In their paper "Some Elementary Examples of Unirational Varieties Which are Not Rational", Artin and Mumford show that the torsion in $H^3(V, Z)$ of a non singular projective 3-fold $V$ is a birational invariant.  This is great because it gives a cohomological obstruction to rationality (there is no torsion in the cohomology of projective space).  They they are able to show that certain conic bundles over rational surfaces are not rational by exhibiting such torsion (their conic bundles are unirational, hence the title).  The paper is very nice.
A: There are some very important 'torsion motivic' statement: the calculation of Suslin's homology, Milnor and Bloch-Kato conjecture (proved by Voevodsky). Also, the proof of the latter statements uses algebraic cobordism and motivic cohomology operations, which do not work integrally.
Also, I believe that Steenrod's operations should be important for algebraic topology, but I do not know anything about that. 
A: Not that I understand anything of this, but there is the following paper by Peter Scholze that seems to be in-topic here:

*

*On torsion in the cohomology of locally symmetric varieties, Annals of Mathematics 182 issue 3 (2015) 945-1066 doi:10.4007/annals.2015.182.3.3, arXiv:1306.2070.

Anybody is welcome to edit this answer adding explanations or insights.
A: There is also the following beautiful theorem of Weyl: a compact connected Lie group $G$ is semi-simple if and only if its fundamental group $\pi_1(G)$ (equivalently, its first homology group $H_1(G)$) is a torsion group; this is proved in Bourbaki - Lie groups and Lie algebras, Chapters 7-9, Corollary 4 on page 285.
A: The first place that one sees that torsion is deep is in the homotopy groups of spheres, which, mod torsion, are described completely by a theorem of Serre. However the torsion part of the homotopy groups of spheres is very complicated.
If we work rationally, that is, if we forget about torsion, then lots of cohomology theories tend to be the same. (There's a general theorem of this sort, but I've forgotten the precise statement.) For example, singular cohomology and K-theory are isomorphic, rationally, via Chern character.
A: [[ Sorry I missed that the question was also concerned with the question in an algebraic topological context. This answer is only concerned with algebraic geometry.]]
I think the first question is much easier to answer. mdeland has given the
Artin-Mumford non-rationality example as one answer. Another is the
Atiyah-Hirzebruch example of an even-degree torsion class of a smooth projective
variety which is not algebraic, showing that an integral version of the Hodge
conjecture is false. This gives examples (and there are others) where torsion
can be used to show something about an algebraic variety which one couldn't show
without (actually I would say that it is more a question of integral versus
rational cohomology even without torsion one can exploit that certain cohomology
classes are not divisible by some particular integer). I would say that gives an
answer to the first question.
The second is of a very different nature. In algebraic topology torsion (and
more general integral cohomology again versus rational cohomology) are
enormously important for understanding the homotopy type of a space. Take as an
example the spheres. Rationally their homotopy theory is trivial but integrally
you have highly non-trivial homotopy groups (this non-triviality does not
reflect itself in the cohomology of the spheres but is closely related to spaces
derived from the spheres, the pieces of the Postnikov tower). Of course
algebraic varieties (over $\mathbb C$, but that is not essential) give homotopy
types too but it not always clear what the homotopy type of an algebraic variety
tells you about the algebro-geometric structure of the variety (unless you
somehow incorporate algebraic topology under algebraic geometry...). There are
some examples though: The torsion in the second cohomology group comes directly
from the fundamental group and in particular give you abelian étale covers of
the variety. The torsion in the third cohomology group tells you about the
Brauer group of the variety and in particular corresponds (for some definition
of "corresponds") to projective fibrations over the variety. The correspondence
is quite indirect however. I would for instance love to know the least
relative dimension of a projective fibration over an Enriques surface which
realises the element of order $2$ in the third cohomology group or even better a
geometric construction of any such fibration. In higher cohomological degrees
the situation is even worse (unless one chooses the above incorporation option,
higher algebraic stacks could be said to do that).
A: I just wanted to add two more examples about torsion in cohomology groups of low degree that came into my mind reading the above (great) answers: 


*

*Any torsion element in $H^2(M, \mathbb{Z})$ for a space $M$ can be realized as the first Chern class of a complex flat line bundle.

*Similar to this, you may know that elements in $H^3(M, \mathbb{Z})$ correspond (up to some equivalence) to twists in twisted K-theory. Now, if that class is torsion, you get a very nice description of twisted K-theory via modules over bundle gerbes. Or, if you don't like twisted K-theory, the torsion elements in $H^3(M,\mathbb{Z})$ correspond to (stable equivalence classes) of those bundle gerbes, which allow a (finite dimensional) bundle gerbe module. 

