When you first get the bike you will find yourself getting PRs regularly without even trying. After a while they get are more elusive!
Plan ahead of time that you are going to go for a PR on a certain date and time.
Taper your workouts like you would for a race which means stop the hard workouts a few days before and maybe just do some short low impact rides the prior couple of days so you're body is loose but you shouldn't be sore at all the day you're attempting a PR.
Drink a lot of water the day before so you're well hydrated.
Don't drink alcohol the night before - or keep it to a minimum.
Get plenty of sleep.
Attempt the PR at a time that you feel like you have a lot of energy - when you are wide awake but not tired.
Wear your favorite outfit - if you are comfortable it may help your performance.
Let other members of your household know that you're going for a PR and ask them not to bother you during the ride.
Set up your environment so it's optimized for you - temperature, lighting, etc. I have a fan with a remote control to keep me cool without being cold.
Have two water bottles and use some type of hydration beverage in one of them like Nuun for electrolytes.
Pick an on demand ride with your favorite instructor and a playlist that you like and will pump you up. For me, this is usually hip hop.
Do a warm up ride of 10 of 15 minutes so you're warm and your heart rate is elevated by the start of the ride. This will allow you to skip the warm up and start the ride at a higher output.
Know what your output was from your last PR for this time (e.g. 45 minute ride). It's important to stay at or above this output for the majority of the ride. You can watch your average output and it should stay above your prior PR. You may not want your average to be too high above the last PR as you want to ensure you don't bonk (run out of energy). Once you get into the ride and are feeling good you can turn it up a notch.
Ignore the instructors directions. You goal is to achieve the highest possible output in a given length of time not to follow the class. You are going to start warm and go hard for the whole class and you'll want to do things that maximize your output which may be a different cadence and resistance than what the class is doing.
Optional: It's not for everyone but a lot of people find that getting into a position like a triathlete on the bike will allow you to user your core and generate higher output. To do this:
Move your seat all the way forward
Increase your seat height so you can just slightly bend your knees
Drop the handlebars way down (potentially to A)
I would recommend ending with a cool down ride of at least 10 minutes since you're going to be at a very high heart rate through the end of the class and then stretching and even foam rolling. This will feel like a race so you will be sore.
Personal Record. This is your highest output at a certain class duration. As your fitness level increases you will be able to exceed your previous "PR." The bike also shows your previous PR above your output on the leaderboard so you can actively try to beat it if you want to.