Frequently the selenoid and motor will be assembled in the same case, or the selenoid will mount directly to the motor case. Typically there are only two required wires for the starter motor assembly to work: the one from the starter circuit (closed by the igintion key) and the "always hot" huge wire from the battery. The circuits are completed to ground - often just through/via the motor body.
Somtimes additional wires are present to supply power to other systems. Also, sometimes there will be a redundant/precautionary grounding strap.