Getting nice, even and secure stitches mostly depends on your tension settings, although bad quality thread and improper threading of the machine can sometimes be responsible for bad stitches and frequently breaking thread.
First let's make sure your Tension is right. If you have a modern table top machine or a computerised machine as above, you don't have to worry much about this, just leave everything on the default setting. But if you have an old-style treadle machine or an industrial, then you might want to set your tension with this guide. As always read your user manual first.
Thread your machine following your user manual preferably with different coloured threads so that you can better see the upper and bobbin threads
With your presser foot UP, pull your upper thread just a little, it should move freely with slight resistance, because the tension discs are open when the presser foot is up. If the thread is too free, tighten your tension screw (Turn to the right or to a higher number), if it is too hard to pull, loosen your tension screw (Turn to the left or to a lower number).
When your presser foot is DOWN, the thread should be hard to pull, because the tension discs are closed.
The same test applies for the lower or bobbin thread. The tension can be adjusted by tightening or loosening the little screw on the bobbin case. BUT this is not usually necessary. Sew a test fabric before fiddling with the bobbin tension.
Testing your Tension
Set you Stitch Length to 2.5mm or 10spi depending on your machine type
Stitch width should be on 0, if you have a zig-zag machine
Put a scrap piece of fabric under the presser foot, lower your presser foot, turn your handwheel towards yourself to lower your needle into the fabric
Now step on your presser foot gently and sew a few stitches. Try to go slowly
Your stitches should be flat and even on both sides of the fabric and should be hard to pull out. These are supposed to be permanent stitches.