Many types of research simply cannot be done by a single person. Likewise, there are career advantages to being perceived as one who collaborates effectively. Let's set that aside, however, and just consider the sort of projects that might be done either alone or by a team.
My experience has been that writing papers alone is great when you want to focus down on some particular technical point that you kind of understand already and have all the tools in hand to develop and refine. I put one out along those lines on average about once every year or so. Such a paper can be a joy to work on for all the reasons you might guess, and there is never any question of relative contribution.
If you do only that, however, you will likely find yourself becoming intellectually isolated and unproductive. In science, as in every other endeavor, Joy's Law applies: "no matter who you are, most of the smartest people work for someone else."
We humans think better when we work with good partners. Finding those good partners can be challenging, and most of us have lots of frustrating experiences while we figure out which collaborators are both sympatico and reliable. A good collaboration, however, will make you smarter, make your work better, and result in higher impact simply because you are bringing together more knowledge, more resources, more perspectives, and different strengths and weaknesses.
Finally, as you grow in your career, you will likely hit a point where you have more projects you want to pursue than time available for you to pursue them alone. Collaborators interested in helping you pursue those ideas thus become indispensable for their ability to increase the number of "getting things done" hours on your project---especially ones like students, postdocs, and staff who look to you for direction.
Bottom line: mix it up, weighting your single- vs. multi-author blend based on your personality and discipline, shifting to more multi-author papers as your career goes on.