How can I repair this detached kitchen sink pipe?
Drain lines are pretty easy to work with.  If you are completely unfamiliar but want to do it yourself I would recommend removing all the drain line you can, ideally all the way from the sink to the wall.  If you want to do less of it, remove the portion you plan to replace and leave the rest hanging.

Once removed bring the stuff to your local hardware/big box store and ask someone for assistance getting you what you need.  Pictures may come in handy there as well, make sure you have one of each of the places where pipes connect to something, also helps to have them for reference when putting it all back together.