Here is how I finish siding at the top of a wall. Note that depending on if there is an overhang or just drip rail, the top of the vinyl J-channel will need to be flashed and sealed.
All of the drawings were taken (and modified) from the Vinyl Siding Institute Installation Manual. I highly suggest that you download the manual from this link.
http://www.vinylsiding.org/publications ... nglish.pdf
Usually at the top of the wall there will be J-channel. But inside of this J-channel, there should be a second trim called Finish Trim or Utility Trim.
When you cut the top course of siding to fit inside of the utility trim, you need to use a Snap Lock Punch tool, to create little flaps which will work as clips. The Utility Trim has an inverted lip to receive these flaps or clips.
This image shows how it all goes together.
Here is how this same technique works under a window. It may show the process better.
Using the Snap Lock Tool takes a little practice to learn exactly where to cut and notch the siding so it is not too loose or too tight when installed. It should fit slightly snug, but not tight.
There are many other factors involved in the correct installation of vinyl siding such as, flashing, window underlayment, nailing, etc. I am just trying to show how to finish the top so that it stays put. Please refer to the Installation Manual for more information.
Hope this helps.