It varied. Here's one example, of viking stuff, where spear heads were attached with a rivet. In addition to that, they were usually made to be a pretty close fit. Moreover, very early metal spearheads (bronze, if not just copper) may have used similar attachment as stone spearheads, the pictures below indicate a wrapped sinew attachement method, though there are others.
Spoiler