Chaque vérité que je trouvois étant une règle qui me servoit après à en trouver d’autres [Each truth that I discovered became a rule which then served to discover other truths]. (René Descartes, “Discours de la Méthode“)
Problem solving, from homework problems to unsolved problems, is certainly an important aspect of mathematics, though definitely not the only one. Later in your research career, you will find that problems are mainly solved by knowledge (of your own field and of other fields), experience, patience and hard work; but for the type of problems one sees in school, college or in mathematics competitions one needs a slightly different set of problem solving skills. I do have a book on how to solve mathematical problems at this level; in particular, the first chapter discusses general problem-solving strategies. There are of course several other problem-solving books, such as Polya’s classic “How to solve it“, which I myself learnt from while competing at the Mathematics Olympiads.
Solving homework problems is an essential component of really learning a mathematical subject – it shows that you can “walk the walk” and not just “talk the talk”, and in particular identifies any specific weaknesses you have with the material. It’s worth persisting in trying to understand how to do these problems, and not just for the immediate goal of getting a good grade; if you have a difficulty with the homework which is not resolved, it is likely to cause you further difficulties later in the course, or in subsequent courses.
I find that “playing” with a problem, even after you have solved it, is very helpful for understanding the underlying mechanism of the solution better. For instance, one can try removing some hypotheses, or trying to prove a stronger conclusion. See “ask yourself dumb questions“.
It’s also best to keep in mind that obtaining a solution is only the short-term goal of solving a mathematical problem. The long-term goal is to increase your understanding of a subject. A good rule of thumb is that if you cannot adequately explain the solution of a problem to a classmate, then you haven’t really understood the solution yourself, and you may need to think about the problem more (for instance, by covering up the solution and trying it again). For related reasons, one should value partial progress on a problem as being a stepping stone to a complete solution (and also as an important way to deepen one’s understanding of the subject).