A spirit is a disembodied intelligent being. It is disembodied in the sense of not being composed of ordinary matter, and intelligent in the sense of being an agent that desires to do certain things. There are two main types of spirits, good spirits and evil spirits or demons.
Origin in folk psychology
The spirit can be seen as an artifact of an incorrect theory of mind. To our ancestors, things in the world could be divided into two categories: things that move about, breathe, and seem to act purposefully, such as people and animals; and things that don't, such as plants and stars. Just as importantly, a dead person or animal looks just like a living one, but does not breathe, walk, talk, or act in a purposeful manner.
From this, it is easy to conclude that there is something in a person or animal, separate from the body, that causes it to act the way it does in life. This spirit, then, contains all of the essential elements of life. Since breathing stops at death, the spirit may be somehow connected to it. And if the spirit is separate from the body, it may survive death.
While this notion may still be used poetically or metaphorically, as science has learned more and more about how living beings function, the notion of a spirit as a literal animating force has become untenable.