I'd like to leave a longish comment with pictures on the drawing aspect. Raytracing is not limited to computer graphics you can and often do see see artists manually raytrace to figure out intersections of shapes on paper with a ruler or even freehand by elbow twisting*.
It is also useful for many physical sciences like mechanical engineering and surveying. Or anywhere where you can use geometry to solve your problem.
While @DanHulme correctly surmises that the mathematical definition of a ray is just a line with a starting point and no ending point (goes to infinity). This is not really what people do, instead it's defined that way to be rigorous. In general it's just a line that goes far enough for the job, and we aren't really interested in the other end but rather how the line interacts with something. Infinity is just a safe way of saying it will in fact interact if possible. Mathematicians are very particular about stuff like that.
Image 1: An example of manually tracing shadows of objects with ruler and pen for an as of yet unfinished answer on the subject here. Mainly here because I had spent yesterday evening doing the rays.
So you see you would use rays whenever you try to find a geometric intersection between two geometric primitives. It's not only useful for shadows, it's for anything where you can intersect two things, with a starting point somewhere. So tracing can be used to find the shape of 2 intersecting surfaces, manually drawing perspective images, volumetric problems, rendering implicit surfaces like metaballs solving mathematical functions numerically etc etc.
* The definition of what now is called a ray was first described by Euclid's Elements about 300 bc. Which predates computers by a safe(ish) margin.