I have quite a bit of information on my website about this, so I would first say check out the section in the FAQ’s called Buying or Selling a Piano?
If you want the “Reader’s Digest” version, I’ll try to summarize a bit.
First, play the piano. Play a song or scale you’re familiar with, and play every key chromatically.
Listen for tone; it should be pleasing, though you will become adjusted to certain timbre as you play more.
Notice the sound and feel as you evenly play each key. There should be minimal variations between adjoining keys, though the bass section will necessarily be heavier than the high treble.
Try the pedals; the right one should allow the notes to sustain. The other one or two will need to be observed with the lid up, or music desk off.
Next, open the top (upright) or take off the music desk (grand).
Look inside for any water markings or obvious stains. The hammers and dampers and visible parts should be a nice even, light colored felt or wood. They should look like soldiers all lined up – no odd spacing or missing parts, etc.
Watch what happens when you press the various pedals. Make sure everything is moving in smooth concert with its neighbors. And the hammers and dampers should all return to their resting position smoothly and together.
Look for different brightness in the strings. Newer strings will be brighter (stainless steel) and cleaner (in the copper windings of the bass strings). If strings have been replaced, there is a good chance more are going to break; that’s often a ‘end-of-life’ indicator for pianos.
Specific to Uprights: If you can get the kickboard off of an Upright, look for obvious nests, scats, or dog food. Also, look for cracks across the bridges, especially the bass bridge. This is a piece of wood with metal pegs inserted in tight formation with lots of tension and vibration constantly pulsing. Wood can fail under such circumstances.
Grands: Look at the large wood surface under the strings and gold metal harp. This is the soundboard. Look for large cracks or discoloration. These could be indications that something corrosive has spilled in the piano. Also check the bridges for obvious cracks in the wood.
These three things will give you 90% of what you need to know about a piano. The other ten percent is something you need tools and technical knowledge for.
That would include checking the pinblock, soundboard, ribs, and other action specifics.