Welcome.....
This is a very difficult question for anyone to answer.....as I don't know your level of motorcycle knowledge is, I could/might inadvertently come across as condescending.
However there are lots of things to look for....
Maintenance-you can ask if there are any records and if not, a general look over of the bike will tell you lots...if it looks "shabby" and unkept chances are the maintenance was not done.
Check the oil
Check for leaks and weeps in the suspension and look under the fairings at the engine.
Look at the oil drain plug to see if it is rounded off or weeping
Check the chain to see if it has been adjusted or cleaned/oil
Open up the gas cap and look inside for any rust
look around the back of the body work looking for rubber "spray" to see if it has had a lifetime of burnouts
When test riding, check brakes, check tracking/any shimmying as it goes down the road, check the acceleration (smooth/bogging), hit a few light bumps and see if it unsettles or makes any weird noises.
All this is to avoid buying someone else's problems and sour you of the bike....
There are more than a few posts on here that this has happened to....