Topological invariants, instantons, and the chiral anomaly on spaces with torsion