Try pairing your Pencil with another compatible iPad. This test serves two purposes:
1) If the Pencil still doesn't work, you will have demonstrated that the Pencil itself has a fault - for which the only remedy is replacement.
2) If the Pencil does work, you have demonstrated that the Pencil is healthy. Having demonstrated that the Pencil is good, try pairing again with your own iPad; in so doing, if you have similar experience to myself, you will have cleared the problem; successful pairing with a different iPad can clear a stubborn pairing issue.
If you don't have immediate access to another compatible iPad, consider visiting any Apple retailer that has display models that you can access - and pair your Pencil with the demo device.
Be aware that if your Pencil has been set-aside for an extended period, unused and uncharged, the Pencil battery may have be damaged through deep discharge. In common with all Li-ion batteries, they must always have some level of charge. If set aside from the host iPad, the battery can be critically depleted to the point of failure in some circumstances.
The tiny internal Li-ion battery is susceptible to permanent/irreversible damage through being left discharged for long periods. Even some “new” pencils can exhibit signs of failure out-of-the-box if they are “old stock”.
It is essential that if you have an Apple Pencil that you charge it regularly - whether used or not - so as to protect the battery from deep-discharge. Do not allow a pencil to remain in low-charge state for any period of time - as the internal battery will fail, rendering the Pencil useless. Setting aside an unused Pencil, for extended periods, is a recipe for premature death of the Pencil battery. It is generally recommended that a second generation Pencil (or Apple Pencil Pro) is docked with the host iPad whenever it is not being actively used - as this will optimally charge the Pencil's battery and protect it from unexpected discharge.
If the Pencil Battery has failed, the only remedy is to replace the Pencil. If the battery has failed and your pencil is within its one-year warranty, you should look to having it replaced by your retailer or at an Apple Store.
Genius Bar Reservation and Apple Support Options - Apple
Gentle warming of the Pencil (such as placing on a hot water radiator), prior to attempting charging of the Pencil, can sometimes resurrect a dead Pencil battery.