The main thing to be aware of when putting in a window is that you will be removing studs, which are the parts of the wall that support the upper floor or roof.
Let's use, for example, a 2'x4' window. You can put in a window that is 2' wide without a header. If the studs are on 16" centers, you will have to remove one or two studs and put a stud by each side of the rough opening.
If you are not too fussy about the exact position of the window, use one of the existing studs for the side of your opening.
Usually for a vinyl or aluminum framed window—check your size of window—the rough opening for a 2'x4' window is 23"x 47", ie. 1" under the named size. The actual size should be 22 1/2"x 46 1/2", thus giving 1/4" clearance around the window.
Here is a picture that may help to inform you of what is behind the drywall or finish on the inside wall.
As you can see the inside edge of the trimmer studs, the bottom of the header and the top of the rough sill, form the rough opening. Between these members and the window frame should be a clearance of about 1/4". Cut the hole through the wall and frame the rough opening.
If the outside wall finish is stucco or wood siding, cut this out about 1 1/2" to 2" (the width of the window flange plus the clearance) around the opening just to the depth before the sheathing, which could be about 1/2" OSB to 3/4" ship-lap or straight boards. For stucco use a carborundum blade on your circular saw.
Put some tar paper around the opening on the outside. The window can now be installed.
On the outside of the window look for drain holes and the nailing flange. The holes go on the bottom when installing the window. Place the window in the opening, center it in all directions and level it, then shim up the bottom slightly to make sure it is level.
Now nail the flange to the outside of the wall. The window flange should go against the sheathing of the outside wall. Nail the flange into the sheathing and into the studs and sill. Don't nail the flange at the top so any settling will not crack the window.
To finish the outside, cut and install cedar 1x4 over the flange and over the existing siding or stucco. You may need shimming material here to bring the surface over the flange, flush with the siding or stucco.
Caulk around the outside of the cedar and the siding or stucco and the inside of the cedar and window frame with a paintable sealant, such as Alex Plus (a latex sealant with silicone).
On the inside of the wall, cut and install the window liner, from the window frame to the full thickness of the inside wall finish to cover up the trimmer studs, rough sill and header.
If the window is only 2' wide, you don't need a header. Just put a 2x4 or 2x6—depending on what the wall was framed with—in its place.
If your window is wider than 2', a header is required to support the floor or roof above it. The header essentially transfers the load above it to the sill plate and ultimately to the foundation, protecting the window from damage due to deflection.
Now add casing around the window, a little paint and sit back, relax and admire your job.
Note: Nowadays, most house framers use double 2x10's for the headers over doors and windows up to a length of 8'. These are placed tight under the top plate. If the window will be wider than 8 feet, consult your local building inspector for the correct size.