Why do bones click?

They don't. Clicking originates from the joints or tendons snapping over a boney prominence.
Gas bubbles. The joint is a closed space. When you stretch the joint, the change in pressure goes down; gas comes out of solution from the synovial/joint fluid; when the joint is relaxed, the gas pops back into solution - it is normal, no problem.
Arthritis. I am not sure I entirely understand your question. However, it is possible that you are referring to the noise made by joints that have lost their cartilage and this may cause the bones to rub against each other.