The central distinction in Avicenna's metaphysics is between a thing's essence and its existence. For most things — tables, people, planets — their essence (what they are) does not include their existence (that they are). A table's essence is to be a flat surface supported by legs; whether any such thing actually exists is a further question. Such things are contingent: they depend on something outside themselves for their existence. But there must be, Avicenna argues, at least one thing whose essence includes its existence — one thing that simply cannot not be. This is the Necessary Existent, and its existence is absolutely independent of anything outside itself.
The argument moves from the existence of any contingent thing to the existence of the Necessary Existent. Every contingent thing depends for its existence on something else. A series of contingent beings depending on contingent beings cannot account for the existence of any of them; the series as a whole would be contingent and would require an explanation. Therefore the series must terminate in something whose existence is necessary — not because something external makes it exist, but because its very nature is to exist. This being is self-sufficient, uncaused, simple (having no essence distinct from its existence), and the ultimate explanation of everything that exists contingently.
The necessary/contingent distinction became one of the most productive concepts in medieval theology. Maimonides incorporated it into his Guide of the Perplexed; Thomas Aquinas used a version of the argument in the Third Way of his Five Ways in the Summa Theologiae; Duns Scotus and later Leibniz developed further versions. The concept of the ens necessarium — the necessary being — became the standard philosophical designation for God in the Scholastic tradition. Kant's critique of the ontological argument is, in part, an attack on the intelligibility of Avicenna's necessary existence — whether "existence" can be part of a thing's essence.
The proof for the Necessary Existent appears in the Ilahiyyat (Metaphysics) section of the Book of Healing, and in a compressed form in the Book of Directives and Remarks. The distinction between essence and existence was developed further by Aquinas and became fundamental to Scholastic metaphysics. Kant's claim that existence is not a predicate is a direct response to the tradition Avicenna initiated.