Motivation - Students learn best when they have a desire to do so.
Challenge - While the task cannot be too difficult, it must not be too easy, or students will not invest.
Fun - If the environment is lively and energetic, students are more likely to try and engage.
A well designed task - Too vague and they will flounder, too structured and there is nothing for them to figure out.
Food - Students are human and they love to eat.
Input - Students need some say in what and how they will learn.
Acceptance and appreciation - Students need to know that their opinions and ideas have merit and value.
Freedom to make mistakes - Mistakes can be an excellent teacher. Students need to experience and embrace them.
Slight discomfort - This is really important. Students cannot be too comfortable, not can they be too uncomfortable, for learning to take place.
When teachers can create classroom environments with most or all of these conditions in place, students are more like to invest in their learning and internalize the outcomes.