JPEG actually uses two types of compression, a lossly and a lossless one. Lossless compression doesn't cause artifacts, so we can ignore that part. The particular type of lossy compression in JPEG, called a discrete cosine transform for the math knurds, allows a tradeoff between compression ratio and fidelity. Most software sufaces this as a "quality" value, ususally on the 0-100 scale with 100 being effectively no or very little loss and things going down from there.
This particular compression algorithm was adopted because it's good at throwing out the kind of things the human visual system doesn't notice as much as other scene components. This is in part why pretty decent looking pictures can have impressively high compression ratios. This is also why it works well on real continuous tone photographs and not so well on synthetic images and line art.
Here is a 200 x 300 region of a larger photograph with the pixels replicated 2x to see them better. This used JPEG compress "quality" 100:

Quality 80, 79% file size reduction:

Quality 60, 86% reduction:

Quality 40, 90% reduction:

The file size reductions were based on JPEG compressions of the whole file so that header structures and other fixed overhead was a small portion of the data.
Notice that you have to look to find artifacts in the second picture, even though nearly 4/5 of the original information was tossed out. JPEG compression artifacts are usually most visible at sharp edges and in slowly changing flat areas. Since line art is all sharp edges, JPEG compression is not appropriate for that.
You can see the compression artifacts getting progressively worse at higher compression ratios. Keep in mind though that the bottom picture retains a amazing amount of the visual information for having 9/10th of its raw information deleted.
The types of artifacts characteristic of JPEG lossy compression are "blockiness" in slowly changing flat areas and "dirt" surrounding high-contrast edges. For example, see the bottom right area in the picture above. That contains out of focus background, so the values are changing slowly. The blockiness is quite evident. For examples of the "dirt", look around the goat's left horn. These two types of artifacts are usually a strong clue that JPEG compression was envolved. Also look for these in the other pictures above to get a sense for what they look like when they just start to appear, and what kind of compression ratio you might be able tolerate in various circumstances.