What are groupoids? As far as I know a groupoid is a category in which every morphism is invertible, however I do not understand this alternative definition:
Let $\mathcal{C}$ be a category with coproducts, $\mathcal{T}$ a pretopology is a collection of morphisms of $\mathcal{C}$ called covers s.t
i) isomorphisms are covers;
ii) composition of covers is a cover;
iii) $g:U\longrightarrow{Y}$ a cover, $f:X\longrightarrow{Y}\in\mathcal{C}^{1}$, the fibre product $X\times_{Y}{U}\in\mathcal{C}^{0}$  and $pr_1:X\times_{Y}{U}\longrightarrow{X}$ is a cover.
The pair $(\mathcal{C},\mathcal{T})$ is called a category with pretopology.
A groupoid in $(\mathcal{C},\mathcal{T})$ consist of
i) $G^{0} (objects),G^{1} (arrows) \in\mathcal{C}^{0}$;
ii) there are five structure morphisms $r$ (range),$s$ (source),$m$ (multiplication),$i$ (inversion), $u$ (unit);
iii) the range and source $r,s\in{Hom}_{\mathcal{C}}(G^{1},G^{0})$ are covers;
iv) $r\circ{m}=r\circ{pr_1}$, $s\circ{m}=s\circ{pr_2}$
First I would like to know why in the definition of a pretopology do we require that $\mathcal{C}$ has coproducts? And what is the relation with this alternative definition of a groupoid with the ordinary one, since here we are assuming that $G^{0},G^{1}\in\mathcal{C}^{0}$ so they have to objects in the category $\mathcal{C}$.
My problem is to think why this definition makes sense, I could have $C=(\mathbb{N},\leq)$ regarded as a poset, the preotopology $\mathcal{T}=\{id_{n}\mid{n}\in\mathbb{N}\}$ consists of the identities in $\mathbb{N}$ but then $G^{0},G^{1}\in\mathbb{N}$ and the only objects are natural numbers, the set of arrows of the groupoid would be a number and this doesn't make sense
I hope someone can help me with this definition, I hope made it clear feel free to ask for more details and thank you in advance.
 A: Adding some extra equations (units, associativity, inverses, etc.), the second definition appears to come from this paper. Reading that paper would help you understand what's going on better.

why in the definition of a pretopology do we require that $\mathcal{C}$ has coproducts?

As stated in section 2 of the cited paper, a pretopology usually is defined in terms of collections of maps that are supposed to be covers. By requiring coproducts, this can be reduced to simply talking about single maps being covers. As the paper says,

This reduces notational overhead, and is ideal for our purposes because in the following definitions, we never meet covering families but only single maps that are covers.

You can think of this as like having a neat definition for a special case of something, but generally it requires some extra property to work.
An example comes from topology. You can define a metric space as being compact if every sequence has a convergent subsequence. That definition is neat, but it doesn't generalize.
Compactness makes sense more generally and sequences having convergent subsequences makes sense more generally, but they don't coincide in general. So even though you can define "compactness" using convergent subsequences for all topological spaces, it only really makes sense to do so for metric spaces (and similar).
We have the same thing with pretopologies. We can define pretopologies on categories whether they have coproducts or not, but the definition that works well without coproducts is not the (simpler) one presented here.


My problem is to think why this definition makes sense, I could have $C=(\mathbb{N},\leq)$ regarded as a poset, the preotopology $\mathcal{T}=\{id_{n}\mid{n}\in\mathbb{N}\}$ consists of the identities in $\mathbb{N}$ but then $G^{0},G^{1}\in\mathbb{N}$ and the only objects are natural numbers, the set of arrows of the groupoid would be a number and this doesn't make sense

Good thing the rest of the definition doesn't require $G^{0}$ and $G^{1}$ to be sets! The structure morphisms you mention in your definition are just that: morphisms.
So these structure maps are whatever is available in your category. In $(\mathbb{N},\leq)$, there isn't much going on. There's only an arrow $x \to y$ if $x \leq y$. The fact that we have structure maps going both directions between $G^{0}$ and $G^{1}$ mean that $G^{0}$ and $G^{1}$ have to be equal in $\mathbb{N}$ and all the structure maps are just identities.
This definition is an example of an internal structure in a category. Basically, all the structure is translated into morphisms and equalities are translated into equations between morphisms.
Here's a simple example. A unital magma is like a group, but only requires that the binary operation have an identity and no other equations. This is purely for simplicity — you can get groups in a similar way with more structural morphisms and more identities.
An internal unital magma in a category $\mathcal{C}$ with finite products (including a terminal object $1$) is an object $M$ together with a map $m \colon M \times M \to M$ and a map $e \colon 1 \to M$ plus the two equations $m \circ (\mathrm{id}_M \times e) = \mathrm{id}_M$ and $m \circ (e \times \mathrm{id}_M) = \mathrm{id}_M$.
This definition uses the standard abuse by identifying $M$ and $M \times 1$. Generally, the two are related by an isomorphism that has to be inserted somewhere in the stated equations.
$m$ is the map representing the binary operation on the magma. $e$ is the map representing the unit. In the category of sets, $1$ is a singleton set and this map simply picks out an element of $M$. The two equations are expressing that $e * x = x = x * e$ for any $x \in M$.
A unital magma internal to the category of sets is an ordinary unital magma. A unital magma internal to the category of topological spaces is a topological unital magma. Of course, this is much more interesting with groups or similar.

More to the point, where did you hear that second definition? I can't imagine anyone presenting the two together as "alternatives" since one is much more technical and general than the other.
