First you must study the tasks that the robot is to perform. If you can describe them mathematically that is even better. For some tasks, you might only care about the position of the tool, and not its orientation. In that case, you would need at most three degrees of freedom (for example, x, y, and z). But you may find that all of the motions of the task are contained in a single plane, in which case the number of degrees of freedom can reduce to two. If all task positions are along a line, you would need only one. Look for coordinates which are changing during the execution of the task, coordinates which are constant can be usually disregarded.
Add to the positional requirements any task needs that relate to the orientation of the tool. Worst-case is that you need three positional degrees of freedom, plus three degrees of orientation. You might refer to this as (x, y, z, roll, pitch, yaw), although other ways of modelling orientation are also possible. Just like with position requirements, you may be able to reduce the number of orientation degrees of freedom - for example, if you do not care about the rotation of the tool about its main axis (such as with a pen-holding tool), then you may only need two orientation degrees of freedom.
You add up the position and orientation degrees of freedom to arrive at the degrees of freedom needed for the task.
The robot design would then need to ensure that all of the required task degrees of freedom can be achieved by the kinematics of the mechanism. Don’t get bogged down by controls, or dynamics, or simulations yet, until you can first determine that the task motions can be accomplished by the mechanism.