"Er führte ein lilafarbenes Fahrrad mit sich."
I'm pretty sure that the dative comes after "mit". And the the dative form for "er" is "ihm", right?
God, I'm around B1 level right now but this still confuses me. Is that bad?
You are right, the dativ comes with "mit".
However in this case you don't have:
mit einem Fahrrad
... but you have the fixed expression you'll find in a dictionary:
etwas (Akkusativ) mit sich führen
You are correct in saying that the dative form of er is ihm.
But: if the subject and the object of the sentence refer to the same person/thing, the ihm/ihr changes into sich.
In this case, mit sich führen is a single verb consisting of several words, so it wouldn't make sense to say *er führte ein Fahrrad mit ihm.
With other verbs, both ihm and sich are possible, with different meaning.
- Er lieh sich ein Auto. — He rented a car.
- Er lieh ihm ein Auto. — He lended him a car. (two different people involved)
"mit" is a preposition, which literally means "put before". It comes before the word that it governs - in this case "sich". And to be sure, "sich" is a dative form (the reflexive dative and accusative are both "sich").
"Er" is simply a subject. Subjects are never inflected away from the nominative no matter what constructions the main clause contains.