Ray tracing involves tracking certain easy rays through the lens. With convex lenses, these are
Lesson 1, convex lens with an object far from the lens.
Lesson 2, convex lens with an object near the lens.
The rules for concave lenses, are similar:
Lesson 3, concave lens. (Note that object placement has little effect on the nature of the image with concave lenses.)
In every case, convex or concave, if the rays leaving the lens actually intersect, the image is real. If the rays leaving the lens must be extrapolated back through the lens to find a point of intersection, the image is virtual.
Now that you have learned how to do simple ray tracing, here is a great simulation that you can used to explore
Clicking on "Screen" in this simulation will let you see how an image is projected onto film or a sensor.