Q: Why should you take a pencil to bed?
A: To draw the curtains!
Explanation: At night, many people close the curtains (shut the curtains, draw the curtains) to keep the light out. “Draw the curtains” is another way to say, “Close the curtains” or shut the curtains.”
One of the uses of a pencil is to draw, that is, create pictures using a pencil and paper.
This joke is funny because it plays with two meanings of the word draw. Here is a video of how to draw a pencil: