Look for anything that can excite him, such as a toy or a squirrel outside the window. Sometimes cats make clicking sounds known as "chattering" when they see a prey. This is normal behavior under this context. If there is nothing resembling a prey and the cat seems to be in pain then you should check with a veterinarian.