It establishes the look and the style and is generally the most ornate part. It's a good place to show off your skills as a woodworker, as long as the design is well integrated throughout the rest of the bed. I will use headboard to describe the assembly and headboard plank to describe the plank. Functionally, the headboard keeps the pillows from slipping off the bed and the wall from getting dirty from contact with heads and hair oils. On the other hand, the headboard doesn't always end up against the wall.
Some people place the bed in the middle of the room.
The nineteenth-century writer Mark Twain placed the footboard of his antique Italian bed against the wall. With pillows against the footboard, he could look at the beautifully ornate headboard down by his feet when in bed. Most people are not quite this eccentric. Headboard heights can vary from just higher than the pillow to many feet higher than the mattress. This is mostly a matter of style and design, although a low headboard makes it easy to knock your head if you toss and turn at night.