If the headrest won't stay in place after you adjust the tilt angle (forwards/backwards), then the plastic "clips" inside it are probably broken and causing the rattle. There are two types of clips, metal and plastic. The clips hold the headrest to the upside down U-shaped metal rod, the ends of which go into the seatback.
If you plan on opening up the headrest, I recommend that you don't pull it off the seatback as the retaining spring clips in the seatback will fall off and cannot be replaced without removing the upholstery.
It's possible that the rattle is coming from the seatback itself. This is caused by vibrations in the car and the fact that the seatbacks don't lock (except in an emergency).