First stretch out the top of the sock so you can study the knit structure and determine how to evenly space the stitches you are about to place around the top of the sock. Think about the ruffle pattern you want to use, and the thread/yarn you are going to use. For thin crochet cotton you will need to put more base stitches, whereas with a yarn like sock yarn or baby yarn you can use fewer. There's a bit of trial and error involved, although there's no exact and perfect number... and many will work and make a nice looking edge. Pick a crochet hook that will work well with your chosen thread/yarn.
Next, put your hook through an opening in the knit near the top of the sock and pull through a loop. I like to do it a couple of holes down so it is sturdily attached. Try to use the same distance from the edge for each subsequent stitch.
Next, pull through a second loop at the place where you think, by continuing evenly, you will get a good stitch count.
Next, yarn over and pull the loop through the two loops already on the hook. I've left the loops loose for ease of seeing in the pictures... keep yours at a better tension!
Pull through a loop at the next space along the top.
Yarn over and pull the loop through the two loops already on the hook. Continue like this all the way around the top of the sock.
You'll end up with single crochet around the top (hopefully more evenly tensioned than mine!) onto which you can build your edging.
Where the end meets the beginning I just pull a loop through the first stitch to attach.
Start your stitch pattern... This one is chain 2, dc in same space, then 3 dc in next sc. *2dc in next sc, 3 dc in next sc* repeat between ** all the way around. I work in both loops, but you can work in just one if you want... it simply looks a bit different. Just be consistent if you want it to look consistent!
Here's what it looks like as you are working your way around.
And here's what it looks like modeled on a dolly napping on the rug.
Now to spend some time with a crochet edging book to pick out which one I want to use for the next pair...