For the benefit of all...
I recall experiencing, on one isolated occasion, my second generation Pencil completely faileding to function with my iPad Pro M1. Nothing that I initially attempted would successfully re-pair the seeming inoperable Pencil with my iPad...
... until the Pencil was paired with a different compatible iPad.
After the successful pairing with a different iPad, the Pencil could be successfully paired with the original iPad Pro M1 - and has worked flawlessly ever since.
If you are seemingly unable to resolve your current problem, 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.
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.