Some headboards come with the hardware necessary for mounting to the wall, but let’s assume that yours didn’t. You can purchase interlocking flush-mount brackets at your local hardware store or home center. These can be attached to the framework of your headboard from behind and in corresponding locations on the wall. Also, you can use a French cleat and span the rear of your headboard as well as several wall studs. Watch this video on how to make a French cleat.