A great instructor and motivating music can make the difference. I have also been to a couple of classes in my area, where they make you compete with other participants in the class by posting your work output on a screen during the class. That motivates me and I believe many other participants as well, to bike harder and it’s more fun too.
Some instructors are naturally good at teaching. Some take a while to get comfortable and find their style. But anyone can become a better instructor. Experience is very helpful. Passion is irreplacable.
Instructors should be warm and inviting. Greet everyone as much as possible. Make an effort to look every participant in the eye from time to time and give encouragement. Be as inspired as you want the class to be. Even on a down day, trying to be upbeat will make the class better.
And good music that you have prepared your class around (preparing for class is an absolute must) will help make a class fun. Some instructors have a knack for picking great music. If you struggle with music, ask for help from another teacher. Don’t know any other teachers? Network to connect with as many as you can. Go to other classes and learn some of the little things that other instructors do to make their class fun.