Some of each, but mostly axles.
Oversimplifying, you detect a train by applying electricity to the track and measuring the resistance between the two rails. If you have an open circuit, there is is nothing on the track, if you have a short circuit, you have a metal axle making contact with both...