The problem you are describing is quite similar to line following from a controls perspective, there is a difference in how the line is detected.
Line following robots use a wide variety of ways to detect line. Simplest is probably photo-resistors or phototransistors, however magnetic stripes (lines) and hall effect sensors have been quite popular in the industrial world some years ago.
Industrial applications of mobile robots have now switched to camera (and laserscanner) based systems. In many cases the camera is downward facing, however upward facing cameras are also not uncommon (not exactly industrial, but roomba vacuums use also partially upward facing cameras)
If you mount a camera on your robot, facing upwards, and the edge of the table is visible, you can use edge detection algorithms to detect the edge of the table. If you are lucky and there is a high contrast between the area under the table and above the table edge detection will perform quite well.
The edge is your line, but you still have to map this to the line you want to follow. The line being in the middle of the camera image is not necessarily what you want, but you can apply simple transformations to make this line your path to follow. If you can deduce a signed distance function (negative distance one side of the line, positive distance on the other side of the line, zero on the line) you can use this signed distance function as an input to your line following controller.
The only difference to a more common line following approach is how you detect the line and com up with the current position relative to the line. Everything else is like a classical line following problem.