How can I fix a relationship with a professor that has recently cooled? What would be a good way to overcome bad experiences with a professor in my department, who is not my main advisor, but from whom I would like to get advice regularly?

During the first year of my PhD, I worked with the Professor in a class on a project that I didn't perform well on (because I was not very interested in that particular project + I didn't feel very confident on the topic by that time). Our relationship has cooled down since, and he was even debating whether or not to put me as a co-author on the paper that came out of the project with multiple students. (the authoring-issue is not part of this question; I mention it to describe the status of our relationship)

Now in my second year of my PhD, I realize that it would be quite valuable to have his advice on other projects that I work on, potentially even as a co-advisor, but I fear I messed up the relationship too badly. 

What would be a good approach to overcome the bad/non-existing relationship? Or would that be a waste of time and I'd rather look for someone else, which could potentially even mean I need to change the focus of my PhD?
My general impression is that professors quite like giving advice (it's almost a job requirement...) but are incredibly busy. I would thus suggest you do not try to change 'your relationship' but focus on the task at hand, i.e. directly but politely ask whether your professor would be available to give you some advice.

Of course there is the possibility that your relationship is so bad that your professor will not even consider meeting with you. In that case I would not try to change his/her mind. Just treat it as a lost cause and move on. 

In the more likely scenario of you managing to schedule a meeting it's important you are prepared and respectful of his/her time clearly signaling to your professor that his/her advice will be not be wasted. If you are clueless about your questions that will quickly signal to your professor that s/he is wasting her time. If however you seem genuinely interested and it looks like you are indeed benefiting from the advice I wouldn't be surprised if your relationship improves significantly and could even develop into something more formal like that of a co-advisor. 

Either way: simply ask that you would like some advice, ideally explaining what makes his/her advice valuable to you. You'll find out how to proceed after that. Good luck!