Kant derives the categories from the logical forms of judgment. Just as there are different ways of logically combining concepts in a proposition (universal/particular, categorical/hypothetical, etc.), there are corresponding pure concepts that determine how objects must be thought. Cause and effect, substance and accident, possibility and actuality — these are not derived from experience but are conditions under which experience is possible.
The categories are purely intellectual; experience is temporal. The 'schematism' bridges these levels: each category is given a 'time-schema' that allows it to apply to appearances. The category of cause, for example, is schematised as the rule that one event necessarily follows another in time — the temporal form that makes causal judgment applicable to experience.
The categories are valid only within the bounds of possible experience. When traditional metaphysics tries to apply them beyond experience — to the soul, the cosmos as a whole, or God — it generates contradictions and illusions. This diagnosis is the key result of the Transcendental Dialectic and the ground of Kant's critique of rational psychology, rational cosmology, and rational theology.
The categories are introduced in the second part of the Prolegomena ('How is pure natural science possible?') and receive their full justification in the Transcendental Analytic of the Critique of Pure Reason.

