Walk into any gym, you'll eventually find a pack of muscle bros egging each other on to deadlift insane amounts of weight. You've probably seen this a few times before, every other day, they are always at it.
These guys are always at the gym right? Right! Having a workout partner keeps you motivated. Those days when you're seriously considering skipping, your partner will force you to show up and do the work.
One of the reasons why group based gyms have become so popular is that your community members ensure that you show up. There's just so many times one can stomach "So we missed you yesterday" before showing up to every single class.