the simple contact lens
The simple answer is the same way as a pair of prescription glasses.
They focus light correctly onto the retina, that tiny membrane behind the eye that sends signals to the brain via the optic nerve allowing the brain to tell you what you're seeing.
If you are short-sighted, like me, your vision is blurred beyond about a meter in front of you. The scientific reason for this is because light rays are focussed IN FRONT of the retina instead of on it.
What the contact lens does, in the same way as a pair of glasses, is to diverge those light rays forcing the eye to refocus backwards onto the retina where is should have been in the first place.
If you are long-sighted, the eye doesn't focus at all and the light rays remain BEHIND the retina so here the contact lens makes light rays converge to increase focus forwards onto the retina for perfect vision.
If you wear contact lenses and you are near-sighted like me, you will have a prescription with a negative diopter (the D part of your prescription), expressed with a minus (-) sign. If you are long or far-sighted, then your diopter will have a plus (+) sign.
Many people wonder why they need to have their eyes checked again if they want to switch from glasses to contact lenses. In most cases, the prescription will be slightly different and this is because contacts are thinner than eye-glass lenses so the point of focus can change.