To connect a pencil to an iPad, you need to ensure that the iPad is compatible with the specific pencil model, turn on Bluetooth on the iPad, remove the cap from the pencil, and then plug it into the Lightning port on the iPad or attach it magnetically to the side of the iPad (in the case of Apple Pencil 2).