As an aid
As a teaching aid (but not in fact a reality) instructors use a model called a traction circle. Your tires can generate traction up to a certain amount in any direction. If you exceed that, the tires slides and you likely crash. Going straight, all of this traction can be used for braking. As you start cornering, some of the traction, perhaps most of it, is being used to turn the bike. Relatively little is left for either braking or acceleration.
Trail braking consists of braking hard while upright, and progressively letting off the brake as the lean angle (turn) increases, as more traction is needed for cornering and less is available for braking. It is not restricted to the rear brake, which in most cases provides very little braking force.
As a secondary effect, hard braking transfers weight (force) to the front tire, temporarily increasing the amount of traction generated by the front wheel, which allows both harder braking and harder turning. Conversely the rear wheel loses the same amount of weight (force) so braking action at the rear is limited. Under braking the bike 'turns in' to the corner better.
Beginners are best served by keeping the functions separate. Brake first, then execute the turn. Managing lean angle as speed decreases can be a little tricky for beginners.
Racers are using all of the traction, all of the time. They wait to brake until the last possible instant, brake hard while upright, then transition to decreasing braking as the lean angle increases.
Generally handy to use the rear, rather than front, brake mid-corner, especially if cornering hard, because exceeding the traction on the rear wheel will produce a slide, which can usually be managed, while a front-wheel slide is usually the first act in a crash. As mentioned above, a touch of the brake will provide a little weight transfer to the front, giving a firmer steering feel.
The effect is very evident in cars. A properly balanced car, if coasted into a turn (no braking or acceleration) will feel a little vague in the front as it turns in to the corner, and the back end may feel a little loose coming out of the corner. Trail-braking will transfer enough weight to the front that the steering is 'sharp', turning in well, and starting acceleration mid-corner (at the apex, more or less) transfers enough weight to the rear that it sticks better coming out of the corner. Early Porsche 911's with a large rear weight bias demanded the technique. Timid drivers that backed off the throttle coming out of a corner invariably spun the car.