This is very broad, but let me try to explain how it might work in a typical case.
You would need to either make or generate a high-res texture for the most detailed level of the terrain. Using a GPU tech like OpenGL or DirectX, we'd then turn on mipmapping for this (power-of-2 sized) texture, to allow the GPU to auto-generate successively coarser versions of that highly detailed quad; each successive level of the mipmap is used when the camera is at some distance away from the surface in question (of course, we use the most detailed when we are very close by, and the least detailed when we are very far away). Even when not using a GPU, this is still a common pattern.
One of the benefits of mipmapping at least in the GPU context, is that sampling the texture is more efficient since not as many texels need be sampled when the player is far away from the textured object. This is typical of any kind of LoD approach - what is further away requires less work to render.
There's no particular formula; you may want to use powers-of-2 distance to determine what level of detail you will display, or this may depend on your field-of-view angle, or some other factors... all down to your implementation and your own choices. Best is to experiment and see what works for you.