Open the clean-out door at the bottom of the chimney. Clean out any ash and soot. If there are shards of clay in the stuff you clean out, that means at least one of the clay flue liner sections in the chimney is broken.
Climb onto the roof and shine a light down the chimney. Look for any cracks, breaks or missing pieces in the sections of clay flue liner. If you are lucky and only the top one or two are broken, you can probably replace them by reaching carefully into the chimney, tapping them loose and removing them, them mortaring in new sections. If the broken parts are deeper within the chimney, the easiest solution is to install a metal liner.
Uncoil a flexible metal liner on the roof. Measure the length of the chimney from the top to the thimble (the hole where the stove pipe is attached), or to the damper if the chimney connects to a fireplace. Cut the metal liner so it is one foot longer than this measurement, using a pair of tinsnips.
Drop a rope down the chimney to an assistant at the bottom. Tie the rope to the end of the metal chimney liner. Carefully feed the liner into the top of the chimney while your assistant pulls on the rope from the bottom. Don't bend the liner any more than is necessary to transfer it from the rooftop to the chimney.
Stop feeding the liner in when your assistant tells you that the bottom has reached the level of the thimble. Attach the bottom of the liner to the inside of the thimble. Attach the top of the liner to the top of the chimney with the chimney cap that is supplied with replacement chimney liner kits. These caps vary between kits, but are usually attached with several simple screws.