A real image is the collection of focus points made by converging rays, while a virtual image is the collection of focus points made by backward extensions of diverging rays.
In other words, a virtual image is found by tracing real rays that emerge from an optical device (lens, mirror, or some combination) backward to perceived or apparent origins of ray divergences.
[1] This is observed in ray tracing for a multi-lenses system or a diverging lens.
For a (refracting) lens, the real image of an object is formed on the opposite side of the lens while the virtual image is formed on the same side as the object.
In diagrams of optical systems, virtual rays (forming virtual images) are conventionally represented by dotted lines, to contrast with the solid lines of real rays.