What size nails should I use to attach the molding around the window on the inside of the house
Use trim nails that will penetrate at least 1/2 inch into the studs. To choose the right-sized nail, add to that 1/2 inch the thickness of the drywall, usually 1/2inch, and the thickness of the trim board. Standard finish nails usually work fine.
Ask your home improvement store clerk for finishing nails. They are as long as you need them but leave very small holes.
Depending on the thickness of the trim...6d, 8d finish nails should work. Countersink the nails and cover with wood putty.