Set your headboard in place, positioned as you want it relative to your bed.
Chalk the outline of the headboard wherever it crosses the frame of your bed.
Remove the headboard and set it aside.
Drill holes through the bed frame, inside the area or areas marked with chalk. Drill at least two vertical lines of two holes each, spaced two or more inches apart if possible. Use a drill bit the same diameter as your bolts. If your bed frame is metal, wear safety goggles to protect your eyes from sparks and metal slivers.
Drill holes through the headboard using a drill bit the same diameter as your bolts. Position the holes to correspond with the positions of the holes in the bed frame.
Return the headboard to its position at the head of the bed. Bolt it in place and secure with the nuts. If you moved your bed in order to gain access for this project, put the assembled bed in the desired location in the room.