Starting with one of the most common issues, ensure that the replaceable Pencil tip is firmly screwed onto the tip of the Pencil. If not tight, Pencil input may not be recognised by the iPad.
If the problem is unchanged, here is one of the better troubleshooting guides for the Apple Pencil - that may be helpful in working through common issues.
https://appletoolbox.com/apple-pencil-not-working-heres-our-troubleshooting-guide/
If you have checked through potential issues using the linked troubleshooting guide, then your Apple Pencil may be displaying symptoms of a dead battery - that will not accept or hold any charge.
Assuming that you do not have any other iPad charging issues - whilst the Pencil is docked-with /connected-to your iPad, verify that the Pencil is recognised:
Settings > General > About
Scroll to the bottom of the page - and you should find an entry for the Pencil. Finding this suggests that the Pencil electronics are good and that the Pencil has paired.
While still docked/connected with the iPad, check the Battery Widget for the charge status of the Pencil. Is it 100%? If not, let the Pencil charge; if it is fully charged, monitor the battery charge widget and disconnect from the iPad.
When disconnected from iPad, does the Pencil disappear from the Battery Widget - or it’s indicated state of charge suddenly fall? If either of these are true, then the Pencil battery is likely to be dead.
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 long periods often results in almost certain death of the battery. Whenever the second generation Apple Pencil is not being actively used, it must be kept docked to the edge of the iPad, as this will optimally maintain and protect the Pencil battery from irreparable damage.
If the Pencil Battery has failed, the only remedy is to replace the Pencil. If the battery fails within its one-year warranty, you should look to having it replaced at an Apple Store.
I hope this information proves to be helpful in both diagnosing and resolving the problem.