Community is a set of people (or agents in a more abstract sense) with some shared element. The substance of shared element varies widely, from a situation to interest to lives and values. The term is widely used to evoke sense of collectivity.
The origin of the word community comes from the Latin munus, which means the gift, and cum, which means together, among each other. community literally means to give among each other. Community could be defined as a group of people who share gifts which they provide to all.
In a relatively liberal use of the term, people who use Wikipedia might be referred to collectively as the "Wikipedia user community". Here, what defines community is the same situation the members are in. Certain changes to Wikipedia affect their well-being, even though their preference of how Wikipedia should be may differ vastly.
When there is a clearly shared-interest (economic or otherwise) among a set of people, the people collectively might be called community. Patients of a serious desease who wish the development of a safer, cheaper, and comfortable treatment, is may be referred as a community in this sense.
In a stricter use of the term, community is a group of people who interact with each other. A virtual community, a group of people exchanging messages or other types of information, is a community in this sense. Here, the members usually share a interest.
An even narrower definition of community has to do with the nature of interaction. In community, interaction is informal and spontaneous than procedurally formalized (such as in bureaucracy), an end in itself than goal-oriented (such as in interest group or advocacy group). The members form tight-knit web-like structure of relations than a hierarchical one. It is relatively popular among social theorists (such as Max Weber, Emile Durkheim, Georg Simmel, Ferdinand Tonnies) to conceptualize community in this way especially in contrast to modernity.
When people describe a group as a community, it typically implies or evokes some sense of harmonious, egalitarian social form sharing their values and lives. The image is most clear in history, thought there are numerous objections that such an idealistic community is hardly a historical reality. A relatively isolated small village in pre-modern society is often called community.
For example, in the United States, services provided by non-profits, corporations, and others to increase welfare of some of the local citizens are often called community services, even when it is offered for a limited segment of them. Here, the service is for the community in a sense it pursues the egalitarian goal and make the local society more like a community.