General Remarks.
In general, you cannot "derive" a representation of a given group $G$ on the objects you're considering, but there are some really standard definitions of certain group representations which are given special names like "scalar," "vector," and so on.
However, given the representation of a Lie group $G$, this induces a representation of its Lie algebra $\mathfrak g$, and determining an explicit formula for this Lie algebra representation is precisely what we do when we find the so-called "infinitesimal generators" of the corresponding group representation.
An example. $\mathrm{SO}(2)$
Let $C^\infty(\mathbb R^2)$ denote the vector space of smooth functions on the plane $\mathbb R^2$. The scalar representation $\rho$ of $\mathrm{SO}(2)$ acting on $C^\infty(\mathbb R^2)$ is defined as
\begin{align}
(\rho_0(R)\phi)(\mathbf x) = \phi(R^{-1}\mathbf x).
\end{align}
for each $\phi\in C^\infty(\mathbb R^2)$ and for each $R\in\mathrm{SO}(2)$. What the heck is going on here? Well, notice that this can also be written as follows:
\begin{align}
(\rho_0(R)\phi)(R\mathbf x) = \phi(\mathbf x)
\end{align}
So this definition encapsulates the intuitive idea that the transformed field $\rho(R)\phi$ evaluated at the transformed point $R\mathbf x$ agrees with the untransformed field $\phi$ evaluated at the untransformed point $\mathbf x$. In physics, it is common to see "primed" notations for the transformed field and transformed point;
\begin{align}
\rho_0(R)\phi = \phi', \qquad R\mathbf x = \mathbf x'
\end{align}
in which case the definition of the scalar representation can be written as
\begin{align}
\phi'(\mathbf x') = \phi(\mathbf x)
\end{align}
This probably looks familiar. So basically the "invariance" that's happening is that the value of the field doesn't change provided the transformed field is evaluated at the transformed point.
Infinitesimal generators.
To find the infinitesimal generators of a given representation, we are really just trying to find a certain representation of the Lie algebra of the group. This Lie group representation $\rho$ naturally induces a Lie algebra representation $\bar \rho$ as follows:
\begin{align}
\bar \rho(X) = \frac{d}{dt}\rho(e^{tX})\Big|_{t=0}
\end{align}
So, for the $\mathrm{SO}(2)$ example, we know that the Lie algebra $\mathfrak{so}(2)$ is generated by the single element
\begin{align}
J = \begin{pmatrix}
0 & -1 \\
1 & 0 \\
\end{pmatrix},
\end{align}
and we can determine how this element is represented in representation induced by the scalar representation defined above as follows:
\begin{align}
(\bar\rho_0(J) \phi)(\mathbf x)
&= \frac{d}{dt}\phi(e^{-tJ}\mathbf x)\Big|_{t=0} \\
&= \frac{d}{dt}\phi(x-ty, y+tx)\Big|_{t=0} \\
&= -y\partial_x\phi(x,y) + x\partial_y\phi(x,y) \\
&= (-y\partial_x + x\partial_y)\phi(\mathbf x)
\end{align}
In other words, in the scalar representation, the generator of rotations on the plane is represented by a differential operator;
\begin{align}
\bar\phi_0(J) = -y\partial_x + x\partial_y.
\end{align}
This same procedure can be extended to find infinitesimal generators of other representations as well, like the vector representation $\rho_1$ of $\mathrm{SO}(2)$ which is defined to act on vector fields $\mathbf v$ on the plane as follows:
\begin{align}
(\rho_1(R)\mathbf v)(\mathbf x) = R\mathbf v(R^{-1}\mathbf x)
\end{align}
By the way, you might find the following links interesting and/or helpful as well:
Tensor Operators
Representations of Lie algebras in physics
Differential Realizations of certain algebras
Generators of Poincare Groups
Idea of Covering Group
Unitary spacetime translation operator
Rigorous underpinnings of infinitesimals in physics