The work is divided into two main parts, the Rechtslehre and the Tugendlehre. Mary J. Gregor's translation (1991) explains these German terms as, respectively, The "Doctrine of Right, which deals with the rights that people have or can acquire, and the Doctrine of Virtue, which deals with the virtues they ought to acquire.
Rechtslehre has also been translated as the Science of Right (Hastie) or the Metaphysical Elements of Justice (Ladd). It is grounded in republican interpretation of origins of political community as civil society and establishment of positive law. Published separately in 1797, the Doctrine of Right is one of the last examples of classical republicanism in political philosophy. The Doctrine of Right contains the most mature of Kant's statements on the peace project and a system of law to ensure individual rights.
The Doctrine of Virtue develops further Kant's ethical theory, which Kant first laid out in the Groundwork of the Metaphysics of Morals (1785). Kant particularly emphasizes treating humanity as an end in itself; in fact the Kant's retake of the second formulation of the categorical imperative (e.g. Groundwork of the Metaphysics of Morals) makes possible to deduce duties. The duties are analitically treated by Kant, who distinguishes: 1) duties towards ourselves; 2) duties towards others. The duties are: 1) perfect duties; 2) imperfect duties. Kant thinks imperfect duties let a latitudo: i.e., the possibility of choose maxims. The perfect duties instead do not let any latitudo and determine exactly the maxims of actions.

Question: How does Kant view humanity?
Answer: As an end unto itself
Alternative answer: As an end in itself.