If you have nice new flat recently plastered walls then it is very much a matter of making sure that your masking/painters tape is securely stuck to the wall. Use a seam roller like this Stainless Steel Wallpaper Edge Seam Roller from Amazon to make sure the edges are nice and flat to the wall. Note, when painting new plaster, you first need to apply a mist coat. Do this before adding any tape or paint.
For textured wallpaper it's not quite so simple. First, put up your painters tape and secure the edges to the wall. Run your thumb or your nail down the edge of the tape to get a tight fit. Now paint the stripe the same colour as the base colour and leave to dry. This will fill any gaps on the tape edge so when you add the stripe colour onto the wall it won’t bleed.