Or more specifically, why do people get so excited about them? And what's your favorite easy example of one, which illustrates why I should care (and is not a group)?
closed as primarily opinionbased by Fernando Muro, Alain Valette, Felipe Voloch, Chris Godsil, abx Jan 21 at 6:43Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question. 


I'm surprised this example hasn't been mentioned already: The 3x3x3 Rubik's cube forms a group. The 15puzzle forms a groupoid. The reason is that any move that can be applied to a Rubik's cube can be applied at any time, regardless of the current state of the cube. This is not true of the 15puzzle. The legal moves available to you depend on where the hole is. So you can only compose move B after move A if A leaves the puzzle in a state where move B can be applied. This is what characterises a groupoid. There's more to be found here. 


As other people have mentioned, a groupoid can be defined as a category in which every map is invertible. A groupoid with only one object is exactly a group, and a groupoid in which there are no maps between distinct objects is simply a family of groups. But there's another class of examples, orthogonal to these ones. Namely: any equivalence relation is a groupoid. In fact, an equivalence relation is exactly a groupoid in which for each object a and object b, there is at most one map from a to b. Concretely, the objects of the groupoid are the elements of the set on which the equivalence relation is defined, and there is a map from a to b iff a is equivalent to b. (A (small) category with the property that for any objects a and b, there is at most one map from a to b, is the same thing as a preordered set — that is, a set equipped with a reflexive transitive relation, usually denoted \leq.) 


Personally, the reason I'm interested in groupoids is something called groupoid cardinality and some other related ideas (the link contains a lot of other links). A motivating idea here is that certain sets X of algebraic objects have the property that (sum_{x \in X} 1) is ugly but (sum_{x \in X} 1/Aut(x)) is much nicer, and so we should think of this is the "true" cardinality of the set (which is actually a groupoid). Interesting combinatorial stuff happens when you take this philosophy seriously: for example, the cardinality of the groupoid of finite sets and bijections between them is e. Why is this interesting? It suggests that one reason exponential generating functions are important is that the denominator of n! is an indication that what you're really working with is some kind of structure defined over the groupoid of finite sets and bijections. And indeed, there's an approach to combinatorics called species theory that defines a combinatorial species, such as "binary trees," as a functor from this groupoid to itself. From this information one can extract a generating function, but the really important point here is that constructions such as the sum of generating functions are seen to be "decategorifications" of more fundamental combinatorial constructions, so one can avoid the machinery of working with generating functions by working directly with species instead. A good reference here is Bergeron, Labelle, and Laroux. 


Another answer is that a groupoid is a space which has no homotopy groups in dimension ≥ 2. (Analogously a set is a space which has no homotopy groups in dimension ≥ 1.) They arise from taking (homotopy) orbits of group actions on sets, as well as from categories (by discarding the noninvertible morphisms and then taking the nerve). People care about them because they retain useful homotopical information, analogous to the relationship between Hom and Ext in homological algebra, and also because they're a lot easier to work with than general spaces. 


A groupoid is a generalization of a group. The easiest definition, IMO, is as a category in which all arrows are isomorphisms. So a group is just a groupoid with one object and arrows the elements of the group. The best example is the fundamental groupoid of a topological space. Build a groupoid by taking the objects to be the points in the space and an arrow from point x to point y to be equivalence classes of paths from x to y. This genearlizes the idea of the fundamental group. They are useful and Ronald Brown has a whole project of building higher dimensional group theory using them. The great thing about the fundamental groupoid is that there is a version of Van Kampen that gives the fundamental group of the circle (without using covering space theory as is the standard way to do it using only the fundamental group). A good link is http://www.bangor.ac.uk/~mas010/nonabat.html ETA: That link might not be working. Google Ronald Brown's Topology and Groupoids book for a good introduction and motivation. 


Penrose tilings are beautiful objects, with a lot of symmetry... but their symmetry group is trivial! So there's a discrepancy somewhere. The answer is: "groupoids"! The topological groupoid of symmetries of a Penrose tiling is nontrivial, and contains all the information that your intuition might call "symmetry". The reason it's a groupoid and not a group is the following. Given a Penrose tiling, there are many different tilings that are locally undistinguishable from your original tiling. These are the objects of your groupoid. It becomes a topological groupoid under the topology of "uniform convergence in any bounded domain". The arrows are given by isomorphisms between a given tiling (=object) and a translated or rotated version of itself. 


Any vector bundle is a groupoid: you can add and subtract vectors only if they are in the same fibre. Similarly, if you take a vector bundle E → M (or some other fibre bundle) then consider the automorphism bundle Aut(E) → M where a point in Aut(E) above p ∈ M is an automorphism of E_{p}. This is a groupoid since these automorphisms can only be composed if they lie in the same fibre. These are discrete groupoids in the sense that there are no morphisms between distinct objects (aka points in the base space). However, they are not discrete topologically as they clearly have topologies! (Which, incidentally, shows that you should be careful when using the statement about groupoids having no homotopy above degree 2: this is a statement about groupoids in Set but groupoids exist enriched in other categories where they can have lots of interesting homotopy). To get a more general groupoid, you can consider the bundle Iso(E) → M × M where a point in Iso(E) above (p,q) ∈ M × M is an isomorphism from E_{p} to E_{q}. One reason for liking groupoids is that they allow you to talk about quotients by group actions without actually having to take the quotient. That's useful because some categories don't have quotients  such as the category of smooth manifolds. So when you have a group G acting on a manifold M you can try to take the quotient M/G but that is quite often not a manifold. So instead you can take the groupoid with objects M and morphisms G × M, where a morphism (g,m) has source m and target gm. Even when the quotient exists, or when you've extended the category to include quotients, this can be much better behaved than the corresponding quotient. 


Beyond all the categorical and bundlelike examples already given, you can easily understand groupoids as generalizations of groups in a purely geometrical sense. If you think of groups as the sets of symmetries of certain geometrical objects, then groupoids are local symmetries of geometrical objects. My favorite example of this consists on taking a manifold M and defining a groupoid G as the set of all the local diffeomorphisms f:U>V where U and V are open sets of M, with multiplication given by composition of maps (whenever it makes sense). 


In addition to the answers already given: Alan Weinstein wrote a nice article for the Notices of the AMS which tries to give some motivating examples: It seems that in certain situations where taking the quotient by a group action "destroys too much information", working directly with an associated groupoid is more useful. Several of the motivating examples in NCG a la Connes (et al) also seem to fit into this point of view. 


I (mildly) disagree with David Brown's assertion that a set is an example of a groupoid. Given any set, you can put a groupoid structure on it, even "canonically", but not uniquely canonically. (By way of analogy, you wouldn't say that a set is an example of a topological space, would you?) Thus if I give you a set and tell you the definition of a groupoid, you will probably be able to use that set to define a groupoid, but you might not come up with groupoid that David has in mind. I want to use this as a jumping off point for my answer: one of the neat things about groupoids is that a lot of times you start with a set $X$, you take some kind of "quotient" of it, and then you are apparently left with a set $Y$ but in a way which feels unpleasant: you feel like there is a loss of information. A lot times, there is a natural groupoid structure on $X$, which has the following features: (i) It is equivalent to or implied by some other kind of structure you are considering on $X$, so it is not evidently profitable to think of $X$ as a groupoid. (ii) Passage to the quotient set $Y$ loses some of the evident structure. (iii) However, if you think of $X$ as a groupoid, then the quotient $Y$ is also a groupoid, and this extra structure is exactly the structure that you were sad to have lost. Example: Let $G$ be a group and $X$ be a set with an action of $G$. Let $Y = G \backslash X$ be the orbit space. In the passage from $X$ to $Y$ we have apparently "used up" the $G$structure, but this is not so good: for applications we would like to know the stabilizers of the points of $X$; up to conjugacy, these only depend upon the corresponding point in $Y$ but in passage to $Y$ we seem to have lost that information, which is however very important for "mass formulas" as in Qiaochu's response. Remedy: realize that any $G$set is canonically a groupoid: the set of morphisms from $x$ to $x'$ is exactly the set of $g$ in $G$ such that $gx = x'$. Then we can take the quotient of this groupoid by the $G$action [this can be done generally; in this case it is sufficiently evident what this means that I don't think it will be helpful to say any more about it], so that $X/G$ still has a groupoid structure, in which no two distinct objects have any morphisms between them but that the automorphism group of any single object is isomorphic to the isotropy group of any representative. See for instance http://www.mth.kcl.ac.uk/~noohi/papers/WhatIsTopSt.pdf for a bit more on this perspective. 


While the categorical definition of groupoid is the most concise, you can also think of a groupoid as being like a group, except where multiplication is only partially defined, rather than being defined for any pair of elements. Here are a few of my favorite examples:
The first two examples happen to be Lie groupoids, and they have corresponding Lie algebroids, which generalizes the relationship between Lie groups and Lie algebras. Whereas a Lie algebra is a vector space with a bracket between elements, a Lie algebroid is a vector bundle with a bracket between sections (as well as an additional structure called the anchor map). For example, if Q is a principal Gbundle, then the gauge groupoid is (Q x Q)/G, while the corresponding gauge algebroid is TQ/G. This comes in handy in geometric mechanics, particularly in reduction theory. If we have a Lagrangian L: TQ > R, which is invariant with respect to the action of a Lie group G, then is useful to look at the reduced Lagrangian \ell: TQ/G > R. There are some subtleties arising from the fact that TQ/G is not a tangent bundle, but it is still a Lie algebroid, so this has motivated the study of mechanics on Lie algebroids. 


I never think about groupoids in any technical sense, but my favorite easy example of one can be built out of a separable field extension K/k. It is the category whose points are the subfields of the algebraic closure of k which are kisomorphic to K. The morphisms between two objects are just the kisomorphisms between the respective subfields. It's some kind of "Galois groupoid" and it's a group if and only if K/k is a Galois field extension. 


Let me expand a bit on what Dave said. The Yoneda lemma tells us that given an object Example: Given a group Example: The functor In both of the above examples, there is no object Anyway, despite the fact that the setvalued functors are not so "geometric", since they are not represented by a "geometric" object (topological space and scheme, respectively), the groupoidvalued functors are more "geometric". In the case of Another very important reason for studying groupoids and another very important class of groupoids comes from, as others have already mentioned, group actions. When a group acts on a manifold or a variety, the naive quotient may be badly behaved, for example it may no longer be a manifold (e.g. it might not be smooth, or it might not be Hausdorff) or respectively a variety (or it may not even be clear how to take the quotient at all!), which makes it harder to study geometric properties of the alleged "quotient". However, the groupoid viewpoint allows us to get a better handle on the quotient and its geometry. More precisely, if There's some further discussion on this sort of stuff at the nLab: 


Contra dance (or square dance) gives us a nice example of a groupoid. The objects are the formations (i.e. the positions of the dancers) and the morphisms are the calls up to homotopy. A choreography (or a dance, if you wish) if a set of composable calls whose product is a morphism between two specific objects. 


A set is an example of a groupoid, and I care about groupoids as a generalization of sets as opposed to groups. My most fundamental tool is Yoneda's lemma, which says that one can think of a category C as being embedded in the category Chat of presheaves (Chat := Hom(C,Sets)); this is a really useful way to think for instance about the category of Schemes (which is special because instead of presheaves you actually get sheaves). Similarly, if you want to think about things like algebraic groups, it is extremely useful to consider Hom(Schemes,Grps) instead. A stack is a generalization of the notion of a scheme, which one would like to think of as a functor from schemes to groupoids; this doesn't quite work (one only gets a `pseudofunctor') and the notion of a stack is a gadget that makes this work. Just as with algebraic groups, sometime you want the target of the functor that your geometric object represents to have the type of extra structure that your geometric object has; groupoids come up for me in moduli theory, where they keep track of extra automorphisms, or when trying to construct quotients by group actions, where you can keep track of stabilizers. So not a very precise answer, but also not a technical one, so maybe it will be useful. 


A groupoid is a category where every morphism is invertible. If such a category has one object, then it is a group. Unfortunately I don't know why people are so interested in them, so perhaps this is not helpful. An example is the fundamental groupoid of path classes in a topological space; the objects are points and morphisms p>q are homotopy classes of curves from p to q. Composition is defined by placing together two paths so this is not a group. 


To follow on from what Qiaochu said, one of the interesting things about groupoids is their cardinality. Whereas the cardinality of a set is a natural number, the cardinality of a groupoid is a positive rational. This gives us a combinatorial way to inject "numbers" into an abstract system. For example, a way to think of matrices of natural numbers is just taking spans of finite sets, A < S > B. The "numbers" come from counting the paths from A, through S, to B. Composition by pullback then just amounts to matrix multiplication. Incidentally, this is one of the nicest ways to think about commutative bialebras, but that's another story (see Stephen Lack  "Composing PROPs" if you're interested). However, if you take spans of finite groupoids instead, you get computation with matrices of positive rational numbers. If you take spans of "nice" infinite groupoids, you get positive real numbers. John Baez and co. have a nice paper, called HigherDimensional Algebra VII: Groupoidification, that works a lot of this out an applies it to quantum physics. It's one of the things that convinced me that groupoids were pretty cool gadgets. 


One reason why people get existed about groupoids which has not been mentioned so far: The category of reduced smooth orbifolds is isomorphic to a category of proper effective etale Lie groupoids. For some investigations on orbifolds, working with their local charts can become very clumpsy. Sometimes, the corresponding question on groupoids has an elegant solution. 


The holonomy groupoid of a foliation is another example of a useful groupoid it is described here: http://www.ams.org/journals/bull/20054201/S0273097904010365/S0273097904010365.pdf For a singular foliation see http://users.uoa.gr/~iandroul/ASholgpdfinal.pdf 


I also unfortunately don't really understand why people care so much about them, although I should probably go back and read old TWFs. Sort of a combinatorial example of the fundamental groupoid is the category assigned to a graph where the objects are vertices and the morphisms are directed paths, and v>w>v = id_v. (If this makes sense.) I believe that this category is nice because (IIRC) you can read off the definition of graph homomorphism from it. ETA: Okay, a quick Baezreview gives the following, which isn't strictly speaking what you asked about but which helps me understand how groupoids are intrinsically special and not just occasionally an improvement that encodes more data than groups. If you move from categories to ncategories, you can define ngroupoids, although this is subtle. Now, just as the fundamental groupoid is a more natural construction than the fundamental group, ngroupoids capture more information about homotopy than do "monoidal ngroupoids." But furthermore, all the constructions of homotopy are in some way reversible (if I'm following Baez correctly)  not only is homotopy equivalence an equivalence relation, but even on higher levels this is true  e.g., the fundamental groupoid functor has an adjoint, which is essentially the classifying space construction, so actually ncategories capture everything about homotopy! And in fact, Baez says that if you think about \omegacategories (which are a limit of ncategories, essentially, I guess?) then the homotopy category of \omegagroupoids is equivalent to the homotopy category. 


Lots of things are groupoids, but many are not groups. There is a theory of groupoids, and if you don't acknowledge groupoids, they won't let you use their theory =) The fundamental group(oid) example is really good. What happens if you want to do Van Kampen's theorem on a pair of sets whose intersection is not connected? There's an answer but you have to use fundamental groupoids. Also, categories are sometimes useful for isolating data. For example, you can replace the usual notion of a local system with a "representation of the fundamental groupoid" and doing so lets you think of a local system the way you already wanted to in your heart: as a collection of operators on fibers coming from "going around the bad points". Here's a stupid riddle for everyone: what's another word for a "monoidoid"? 


As above, a groupoid is an object where every morphism is an isomorphism, and generalizes groups. As for why to get excited about them, they're useful in classification of things. Like, say you want to understand vector bundles on a space. One method of doing so is constructing the "stack" of vector bundles on that space, which, to each open set (actually, a bit more generally, but thinking concretely here rather than going to grothendieck topologies) associates the groupoid consisting of vector bundles on that open set along with isomorphisms, so that the set of vector bundles is the set of isomorphism classes in this groupoid. The stack made up this way has the property that any family of bundles (or whatever, groupoids work for many things) over some space T is equivalent to giving a morphism from T to the stack. 

