Prime and paint the wall as usual if you think it's due for some freshening up. It will be harder to paint it around your painted headboard later, so it pays to give the wall a new coat first if it hasn't had one recently.
Measure the height and width of your bed, and determine the height you want your painted headboard to be. You will need these dimensions to help you create a template.
Decide the shape you want for your headboard. You can keep it simple with a rectangular shape, or you can make it more ornate if you like. Lay out a large sheet of butcher paper and begin tracing your desired design. Use stencils, templates, rulers, a compass or whatever other tools you wish to help you trace a design and make it even.
Cut out the design with a scissor or a craft knife. Tape the design to the wall where you want your headboard. Put your bed in front of it to make sure it is in the exact space and at the precise height you want.
Trace the design on the wall with a pencil. Remove your template.
Select a color for your headboard. Paint on the wall, remaining inside the lines you traced. Allow the first coat to dry, and give it a second coat if necessary.
Allow the paint to dry thoroughly before putting your bed back in place.