What transposing actually does
Transposing moves every chord in a song by the same number of semitones. Nothing about the internal relationships changes: a progression that went from the tonic to the fifth still goes from the tonic to the fifth, the intervals between chords are identical, and the melody keeps its shape. Only the absolute pitch moves.
That is why a transposed song is recognisably the same song. C G Am F moved up two semitones becomes D A Bm G, and anyone who knew the original will hear the same progression in a brighter register.
The arithmetic is a single modulo operation:
Twelve semitones make an octave, so shifts wrap around. Moving up 3 semitones and moving down 9 land on exactly the same chord letters, one octave apart. That equivalence is useful when you are choosing a direction: if up 5 puts the melody uncomfortably high, down 7 gives the same chords in a lower octave.
Chord quality rides along untouched. The root moves, the suffix stays. Am becomes Bm, Cmaj7 becomes Dmaj7, Gsus4 becomes Asus4. Slash chords need the bass note moved too, so D/F# up two semitones is E/G#, not E/F#. Forgetting the bass note is one of the most common transposition errors, and it is audible immediately because the bass line stops making sense.
Spelling follows chart convention rather than strict theory: flats in flat keys such as F, Bb, Eb, Ab and Db, sharps elsewhere.