Here is a pretty quick explanation.
Starting from where the water will enter the drain and ending where the water will flow out, dig a ditch that's about 10 inches deep and 6 inches wide. Keep in mind that you will need to dig deeper if your starting point slopes upward.
Lay about 2 inches of rock into the trench before placing the pipe lengthwise into the ditch.
Cover the pipe with another layer of rocks, again about 2 inches.
Fill in the remaining space with soil and then plant some grass.
Here is a pretty good video, which also shows it's a good idea to add a clean-out.
They also say you should not use flexible corrugated perforated plastic drain pipe, because it cannot be cleaned like rigid pvc can be.