Upright Piano: When a key is depressed by one's finger, the capstan button on the back of the key pushes up the wippen. Wippen raises and the jack escapes from the butt then the hammer get leaned towards the string. When the felt hammer strikes the string it causes it to vibrate. This energy is transferred through the bridge into the soundboard, which resonates. Pianos can be played softly (piano) and loudly (forte), unlike previous keyboard instruments which produced sound by plucking the string--instead of striking like pianos do today.
For further description, including an animation of the piano action working, visit: