There are three predominant reasons why paint will bleed under a stencil.
1. Gaps between the edge of the stencil and the surface of your wall.
2. Excessively runny paint or too much paint is applied to the stencil with your brush or roller.
3. Brush technique is too aggressive .
It is much easier to attach a stencil to a smooth, flat surface than an uneven or textured one. A superior way to attach your stencil to a wall or canvas is to spray the back of the stencil with contact adhesive.
After spraying the adhesive, allow it to go tacky. This takes around two minutes or so depending on the temperature of your local environment.
Don't try attaching the stencil on to your surface while the glue is still wet. Doing so, will make the stencil difficult to remove and even worse, leave bits of glue on the wall.
Now, when the stencil is nice and tacky, place it in position on your wall and pat it down "gently but firmly" with a piece of folded up paper towel or clean rag. Make sure that all of the edges of the stencil windows are all completely in contact with you painting surface.
That's it, simple and achievable. One small but relevant point I should make is... that you don't have to re-spray the stencil with glue for every impression you make. One spray should last for three or four impressions. If the tacky-ness starts to diminish, and it will after a while, give the stencil a bit more adhesive.
In order to achieve nice crisp clean edges on you stenciled image, the stencil film needs to be firmly tacked onto the surface of your wall, canvas, or fabric. That means there should be no gaps between of the stencil window and your painted surface. This goes for walls, canvas and fabrics.
I have have seen a number of stenciling tutorials where the stencil is secured against a surface with nothing but sticky tape. This as a sure-fire recipe for getting paint behind the stencil film.
Every part of the stencil window (the shape in the stencil that paint goes through) really, really needs to be firmly stuck to the surface that you are painting on. Furthermore, your painting surface need to be reasonably smooth and free of lumps and cracks.