In natural environment, cannabis plants get their nutrients from the ground, rainfall and sun. If kept indoors, it is the grower that is responsible for providing them with enough nutrients and micro-elements for the plant to thrive.
The three basic ingredients of the plant diet are Nitrogen (N), Phosphorus (P) and Potassium (K). The ratio between its content in a given nutrient is usually described in this order - N-P-K (e.g. 4-3-3, or 3-2-5, meaning three parts of nitrogen, two parts of phosphorus and five parts of potassium). Those are the absolutely necessary elements, without which the plant will not grow.
If you have our eye on juicy buds and decent crops of marijuana, you will need to give your plants much more than just the absolute minimum, however. A whole array of supplements, flower stimulators, root enzymes, taste improvers, flushes etc. exist, using which you can help your plant develop into a healthy bush - you will be rewarded for that, generously.
In most cases - apart from the safe, 100% organic nutrients - too much of the good thing can actually kill the plant, so keep strictly to the producer's guidelines. Though some adjustment may be done to the feeding schedules, grasping them with all the possible implication is what makes a great grower and only comes with years of experience.