Since you're asking the question, I'm going to assume you're not a woodworker.
Any nails that remain in the trim, pull them out from the back side using a pair of pliers.(Twist the nails around the pliers and they'll come right out)
Any nails that remain in the slide you can either pull out or drive them in until their flush with the wood.
Then put some glue (Gorilla Glue is good, and there's always the old standby of Elmer's) on the trim, put it in place and hold it there with some tape - 2" masking or duct tape.
Put tape at the top of the trim, and at the bottom, and at least two or three places in between.
Pull the tape TIGHT across the front of the trim and onto the side of the slide - that's what's going to hold your trim in place while the glue dries.
Leave the tape in place for at least 12 hours but less than 24 (so the glue on the tape doesn't become an icky mess on the trim).
Take off the tape, clean off the glue residue and you're done.
I'm recommending against using nails because of the fairly high risk of splitting the trim and/or just mucking up the finish on the trim due to your inexperience in working with wood. (No offense of any sort intended, but starting your wood working journey with a piece of highly visible, and probably hard to replace, trim is probably not the best place to start).