How are obj files textured?
OBJ files typically contain vertex positions, texture coordinates (also known as UVs), and normals, as well as face data. There are other kinds of things they can contain but those are the most common (see here for a fuller specification).
Vertex positions are specified with the v command, texture coordinates with vt, and normals with vn. The faces then reference those values by index using something like f 1/2/3 4/5/6 7/8/9, where each grouping of values represents a vertex on the face, and the numbers separated by slashes are the position/texture/normal indices.
The texture coordinates are the part that tell you what point in the texture image (jpg) goes with that vertex. If you've downloaded or exported a model that has a texture mapping, you should be able to see those vt commands in the obj file.
If a model doesn't have texture coordinates, though, then it most likely needs the help of a human 3D modeler. It is not easy to create usable texture coordinates for a model automatically (this is a big research topic). 3D modeling applications have various tools to help the modeler set up a texture layout, but it still usually needs some hand-tweaking to work well.