In this book we discuss some topics about topology and superstring backgrounds with D-branes. We start with a mathematical review about generalized homology and cohomology theories and the Atiyah-Hirzebruch spectral sequence, in order to provide an explicit link between such a spectral sequence and the Gysin map. Then we review the basic facts about line bundles and gerbes with connection. In the second part of the book we apply the previous material to study the geometry of type II superstring backgrounds. We first present the cohomological discussion about D-brane charges in analogy with classical electromagnetism, then we use the geometry of gerbes to discuss the nature of the A-field and the B-field as follows from the Freed-Witten anomaly, finally we discuss the K-theoretical approaches to classify D-brane charges. In the last part we discuss some topics about spinors and pinors, with particular attention to non-orientable manifolds.