Most missions and tasks in Harry Potter: Hogwarts Mystery are based on events. These events may involve learning a spell or making elixirs. Sometimes, you'll talk with other people or engage in combat. The bottom line is that these quests follow the same, repeatable pattern.
The duration of the event is shown at the top of the screen. Depending on how long the current event lasts, you'll be left with a number of tasks. The event ends after the time elapses or when you complete all tasks. The tasks are marked with stars. If you score all of the stars, the event is concluded.
The tasks undertaken during events cost you your energy points. You can replenish them at any moment using gems, rewards, or simply waiting until the points replenish themselves. You can leave the place where the event takes place at any moment and go to a different room. All you have to do is to press the button shown in the screenshot above. This enables you e.g. prod Dobby waiting next to your room.
You can choose your reward after reaching a certain part of the event. Once you've chosen the reward, you need to perform a task to gain it. The task involves performing a spell or answering a question from the professor.
You can take part in classes while completing storyline quests, but you can also come to study if you want to engage in a different type of activity. Good behavior during the class will result in additional character and house points. Thanks to them, your house can advance in the ranking, which will result in additional rewards at the end of the year.