The leg press is an isolation exercise that primarily targets the quadriceps - the front of the thigh. It also works the glutes, adductor (the inside of the thigh) and the calves. The hamstrings also participate as stabilizers.
The leg press is a fixed plane of motion where there is little stabilization required from your muscles. This allows you to isolate your quads much more and use heavier weights resulting in maximal muscle activation which is great for building muscle. On the downside, less work from stabilizing muscles means a less natural and functional movement that might cause strength imbalances and increase the risk of injury. While the leg press is an isolation movement that mostly works the quads, the squats are a full body exercise that engages your core and upper body as well, giving you more bang for your buck
The benefit of the leg press is that it is not nearly as technically complicated as the squat, especially under heavy weights. So the leg press might be a better choice if you don't have a perfect squat form. Another benefit is that the leg press lets you work a different range of motion of the hip joint than the squat. The leg press machine provide back support which may reduce your risk of hurting your back. Lastly, most leg press machines have range of motion limiters that prevent the weight from falling and squashing you if you fail to complete a repetition, this is safer especially if you train alone.
Use the entire range of motion. To maximize the amount of stimulation and growth you can achieve you should train the muscle for the entire range of motion. Try to bend your legs for as much as you can without allowing the tension to leave your quads. Don't bring the weight too low though, if the stress starts to shift to the lower back, or your lower back begins to round, stop, and press the weight back up. It is easy to injure your spine if the back rounds. Everyone's body is a little different, for most people, lowering the weight until the knees are bent at 90 degrees is a good range.
Make sure you're familiar with the locking mechanism of the machine at the bottom. Most leg press machines have range of motion limiters that prevent the weight from falling and squashing you if you fail to complete a repetition. Make sure you know how to use that mechanism for a safer workout.
Press the weight through the heels, not the toes. Most people don't pay much attention to it while doing the leg presses, but pushing through the heels is important to maintain healthy knee joints for the long term. Pressing through the toes puts a lot of unnecessary pressure on your knees, which adds up overtime and might lead to injury.
Where you place your feet on the platform is important. Placing the feet too high on the platform will shift the weight from the quads to the glutes. While placing the feet too low will diminish your ability to press through your heels. The optimal position for feet placement very much depends on your individual body structure. Experiment a little to find a position that maximizes the pressure on your quads while still allowing you to press through the heels.
Don't let your knees to drift in or flare out. Keep the knees on the same distance as you feet. Letting the knees to drift will lower your strength to push the weight and might increase your risk of injury.
Avoid locking your knees at the top. Locking the knees will shift the stress off your quads, and simultaneously increase the pressure on the knee joints. This is not what you want. Keep a slight bend at your knees at the top position.