Pencils are tools used to draw pictures. A draw can also mean a tie. "The outcome was a draw" can mean that the outcome was a drawing, or the outcome was a tie since the pencils are in a race. This joke is a play on the word draw.
Two pencils decided to have a race . The outcome was a draw .