According to economists, there are typically two ways that labor unions can get higher wages for their members. They can A) reduce the supply of labor or B) increase the demand for labor.
Unions can increase the demand for labor by reducing the number of hours that each worker works, for example. In the case of a teachers' union, they can do things like pushing for smaller class sizes. These sorts of actions force employers to hire more workers.
Unions can decrease the supply of labor by requiring that the companies they work for can only hire union members. This means that the company has a smaller pool of workers to hire from. When there is less supply of something, its price goes up. Unions can also impose rules about who can do certain jobs, like requiring university professors to have a Ph.D. instead of just a masters, for example.
Of course, these things are only possible if a union has the power to enforce them. The union has to have enough power to get the firms to agree to the union's demands. This is why unions are much less powerful today than they were 50 years ago (in the US). More companies these days are unwilling to agree to union demands.