For me the best approach depends on whether you can actively pay attention to the speaker’s voice or not. There are two very different methods to get the most out of those two scenarios:
Problems with the speaker
This is the case where the speaker is monotone, has nothing interesting to say, or at the very worst, just has absolutely no clue about public speaking (fills sentences with awkward "um"s, stutters, or loses focus and goes off on tangents).
In this case, it's probably best to get as much as you can from the presentation. Focus specifically on that and tone out the speaker, which if monotone shouldn't be all that difficult.
While doing this, take notes and work out some of the problems or exercises, if any, for yourself. Make up an exercise if none are given, or otherwise start trying to make sense of the material and put it to use in any way you can. This way you will have something to do and stay engaged, while still learning the material.
And there's always caffeine.
Problems with the presentation/content
Maybe you have a great speaker, but nothing being spoken goes with the slides, or (my personal pet peeve) the font on the slides is too tiny or poorly formatted to get anything from anyway. In this case, just ignore the slides altogether as they will only serve as a distraction.
Focus on the speaker, take good notes on what is being said, and really think about the concepts in your mind. Mull them over and write down questions you might have, even if it's not an open format where you can ask them during the lecture. This way your mind stays engaged. Take on thought experiments with the material – if this happened, what would the result be? Or: if I used this idea here, how might it help? Find ways to immediately apply what you are learning, and if that's not possible (if it's more theory-based stuff) just follow along the best you can.
If chewing gum helps you to think, do that. Grab an energy drink or whatever helps you stay focused. I find it's a lot harder to pay attention when the speaker is boring than when the presentation is boring.
Problems with both
In your worst case scenario, the speaker is lackluster and the content is dull and dry, with a presentation that is difficult to follow. You can try the following tips:
Use an actual pen and paper for notes. The act of writing can help you remember things better.
Try to remember earlier parts of the presentation, especially any bits that you found interesting or wanted to go back to later. The act of remembering solidifies concepts in your mind. If you go a week without using a password, that's when you forget it. The same applies to anything you learn.
If it's a Q&A format, ask questions. Don't make up nonsense if you can't think of any, but it will help you concentrate just by trying to come up with some.
Act as if you are the official meeting notes taker. Record any dialog that goes on if questions are asked. This can help you organize your notes, and will also serve to jog your memory when going over it later.
Put away your phone or anything that might provide a distraction. Turn your laptop or other device on airplane mode to keep it from buzzing or blinking unexpectedly.
Close your eyes. This is a known technique for helping your other senses get more information. Sure you might be lulled to sleep, but depending on the situation, it might help you concentrate on the speaker better. Listen to the speaker's exact tone and phrasing.
Breathe deeply, through your nose. If you are feeling sleepy, this can help you stay awake. Make sure when you breathe, your stomach expands and not your chest. When you take good, deep breaths through your nose from your diaphragm, you get much better breaths and feed your brain with oxygen.
Other answers mentioned taking a break. Go grab a bottle of water or energy drink, or take a short walk. Read some of your notes aloud while on your break.