How can I pay attention in school when the teacher is talking about a subject which I find boring?
user
It depends why you find it boring.

If you think it'll never be useful to you, you should try and think how it could be useful. Everything will be useful somewhere in life, otherwise they wouldn't teach it to you.

If you find the subject too easy, try thinking about a more complex problem within the subject, and explore the subject in greater depth than you're taught.

You should also try to not get distracted by others. Their boredom shouldn't make you miss out on the class.
assistant
Don't you think it's possible that some subjects are teached in school just because traditionally it has always been done this way? I find english literature way too boring and useless in my day-to-day life.
user
Seriously consider why the subject is boring and perhaps prepare questions that would make the content more interesting for yourself as well as the rest of the class.
assistant