You need a scope base that mounts to the rifle, and a set of scope rings that mount to the scope. Eventually, the rings will clamp to the base and tie everything together. Most new Ruger 10/22 rifles come with a factory scope base in the box; it's a little rail with 4 screws to hold it in place on top of the receiver.
Overall, it's not a difficult process, but if you've never done it before, there are many little pitfalls along the way, such as getting the right rings, leveling the scope's crosshairs, and making sure the eye relief is correct. If you bought the rifle from a local gunshop or sporting goods store, then I'd ask them if they can install a scope for you, and how much it will cost (some will charge a lot, some only a little, and some will do it for free -- but you'll still have to pay for the rings). Otherwise, a quick online search will reveal many different videos on how to mount a scope; watch several of these before attempting the task (or even before buying the scope rings).
If you are going to do it yourself, once you understand the process, go to a local gun store and tell them you need scope rings to mount your scope (tell them the scope model, or show it to them) to a Ruger 10/22 rifle (and show them the scope base). It's important to show them the parts you already have, so they can find the right rings to mate the parts correctly (things such as the type of rings to grab onto the factory base, and the height of the rings to make sure the front of the scope doesn't hit the barrel or rear sight).
Once you have everything, watch the videos again, and then put it all together. If you use screw glue (LocTite) on the ring or mount base screws, let it "set up" at least overnight before test firing. Watch a few videos on how to sight-in (or zero) a riflescope, and then head out to a safe rifle range or rural area to testfire and sight-in the rifle/scope/ammo combo.
First, how do you plan to shoot the rifle with the scope mounted? I ask this because if you are only planning to shoot off a bench, or freehand standing, the ocular (rear lens) of the scope can typically be mounted much further back than if you plan to shoot from a sitting, or especially a prone position. Shooting prone places your head much further forward and you cannot compensate for a scope mounted too far to the rear by shortening your neck. On the other hand, you can compensate for a scope mounted further forward by "turkey necking".
The stock accessory rail that comes with the Ruger 10/22 works pretty well but is somewhat limited. First off, it is a combination rail with a 3/8" dovetail center section with a Weaver rail outer diameter and Weaver slots. Weaver rails differ from Picatinny rails in that the slots are slightly narrower than the Picatinny slots, and the slots are not regularly spaced and positioned. The limited number of slots on the Ruger accessory rail can limit somewhat which scopes you can position correctly. Also be aware that most rings that are made for Picatinny rails will work with Weaver slots, but not all. Some rings will have cross-bolts that are slightly too thick to fit in Weaver slots. So if you use the stock Ruger rail, buy rings that are labelled "Weaver" or "Picatinny/Weaver".
When you shop for rings, know the diameter of the center tube of your scope. Most are 1" diameter but some very good scopes have a 30mm center tube diameter. Rings for 1" tubes will not work with 30mm scopes. Some 30mm scope mounts and rings will come with spacers that allow you to mount a scope with a 1" tube.
Before you buy rings or mount your accessory rail, try to get a rough idea of where you need to mount the scope on the rifle. All scopes have certain characteristics called, eye relief, eye box, and exit pupil. If your head is too close or too far away from the ocular lens you will not have a full field of view through the scope. You will see what is sometimes called a "ghost ring" or vignetting, which is a dark ring or dark arc around the field of view. Eye relief is the maximum distance that you can have your eye behind the ocular without vignetting but eye relief is not necessarily a constant. On scopes with variable magnification, the eye relief almost always becomes less as magnification increases, so when deciding where to position your scope, set it to maximum magnification if it is adjustable.
To achieve a full field of view through the scope, your eye also needs to be positioned more or less centrally behind it. The eye box is an imaginary cylinder in space behind the ocular of the scope that your eye must be in to achieve a full field of view. This cylinder will start somewhere behind the ocular lens and will extend to where ever the eye relief is. The diameter of that cylinder is called the exit pupil. Exit pupil is determined by the diameter of the objective lens (forward lens) divided by the magnification. So if you have a scope with a 40mm objective set to 10x magnification, the exit pupil would be 4mm making the eye box pretty narrow. That means you would have to be pretty precise in where you positioned your head and eye to achieve a full field of view.
The Ruger accessory rail will not allow all scopes to be correctly positioned with straight up vertical scope rings. If you plan to shoot from a prone position,you will not be able to position many 3-9x40 scopes far enough forward unless you use a ring set that has at least one forward extension ring, or use a one-piece cantilever scope mount. There are also extension Picatinny rails made for the Ruger 10/22 that reach farther forward on the receiver up to the back of the stock Ruger rear sight that allow more flexibility in scope mounting. Evolution Gun Works makes one such rail. If you get in whatever shooting position you plan to use that is least forgiving in terms of scope position, and have someone hold the scope over the receiver and move it forward and backward with it set to maximum magnification, you should hopefully be able to determine whether the stock Ruger rail and straight vertical rings will work for you or not.
Be aware that very few accessory rails including the stock Ruger rail, will allow you to use the stock Ruger 10/22 sights with the rail mounted. The rail will almost certainly obscure your view of the rear sight.
As for ring height, most shooters try to position the scope as close to the bore axis as possible by using the shortest rings that the rifle and scope will allow. This allows you to get a better cheek weld on the comb of the stock. But the rings need to be tall enough so that the objective bell and lens housing clears the rear sight and barrel. And depending on your scope position, the ocular bell and the magnification adjustment ring may actually wind up above the rear end of your accessory rail and will require rings high enough to provide clearance. Unfortunately, there is no uniformity in what different ring manufacturers call "low", "medium" or "high" rings. Hopefully the ring manufacturer will publish either the "saddle height" or the ring height to center measurement. The saddle height is the distance from the top of your accessory rail to the very bottom of the scope tube. The center height is the distance from the rail top to the center of the scope tube. If you did a trial positioning of your scope as I suggested, you will hopefully be able to determine what height rings you will require for adequate clearance, whether the Ruger accessory rail will work or not, and whether you require extension rings or a cantilever mount to correctly position your scope.
Once you find a set of rings and a rail that fit your scope and have the rail mounted, attach your rings to the rail and mount the scope loosely in the rings so you can move it forward and back. Set it to maximum magnification and get in whatever position you plan to use that is least forgiving wrt scope placement. Then move the scope back just to the point where you have a full field of view through the scope. This will provide maximum eye relief in that position at maximum magnification.