You'll want it to extend a bit past the edge of the roof to keep water and leaves from blowing under at an angle.
The last one I put on extended almost to the edges of the flange and seems to work better than previous installations that extended just a bit past the edge of the slide roof.
The awning rail is screwed about every 6" and you don't need to worry about hitting framing. Carefree's come with the awning rail and all necessary screws for it. You'll need some butyl tape to seal the screws.
I've never installed a A&E but for a Carefree you will need to order the end brackets separate as they come in a short or long version. There are notes on the mfgr web page to help you determine which you will need. I use Silicone to seal the end bracket screws.
You can install the mounting brackets and rail easily by yourself, but I need help sliding the topper material into the awning slot.
Good luck with the task.