I am trying to solve exercise 2.6 in Milne's book on Algebraic Groups, which states the following:
Let $k$ be a a field of characteristic $p$, show that the isomorphism class of extensions $0 \rightarrow \mu_p \rightarrow G \rightarrow \mathbb{Z}/p\mathbb{Z} \rightarrow 0$, with G a finite commutative alg. group, are classified by extension $k^\times/(k^\times)^p$. Show that $G_{red}$ is not a subgroup of G unless the extension splits.
After trying for a bit, I wasn't even able to construct any non trivial extensions that fit into the above sequence, let alone have any idea on how to classify such extensions. I also tried constructing extensions using the functorial approach but couldn't find anything non trivial there either. Help in constructing those extensions would be greatly appreciated!
Edit: The following isn't an answer, but is here to complement @AlexYoucis answer based on my time with trying to understand it and working it out, hopefully this will be useful for any future reader. Please read it after reading the below answer.
First, for the ring of functions of G. We may work on each coordinate seperately. Our condition in the coordinate $i$ is functions $f(X,Y)$ that satisfy $f(X,T)=f(X(T/S)^i,S)$ where $S,T$ are p'th roots of a, and $X^p=1$. We may write $f(X,Y) = \Sigma c_{nm}X^nY^m$ where the sum runs over pairs $(n,m) \in \mathbb{Z}/p\mathbb{Z} \times \mathbb{Z}/p\mathbb{Z}$ Easy combinatorics show that for $i\neq0$ this gives a polynomial ring generated by $XY^i$, which is isomorphic to the field $k(\sqrt[p]{a})$. For $i=0$ this gives the polynomial ring generated by X, which is isomorphic to $\mathscr{O}(\mu_p)$. And our ring $\mathscr{O}(G)$ is the product of those rings. Note in part that this ring is non reduced.
Secondly, I had an issue with the fact that $G(k)$ doesn't surject onto $\mathbb{Z}/p\mathbb{Z}(k)$, as would be expected from an exact sequence of groups. This is infact just a misunderstanding by me of what it means for a sequence of algebraic groups to be exact. For an algebraic group sequence to be exact, the functor of points sequence is only required to be left exact. The condition for right exactness here is instead that the map is faithfully flat (alternatively - flat + surjective as a map of schemes), so that the above construction of $G$ does give us a valid extension.
I am not sure what Milne has taught you up until this point, but I will tell you how I would approach this problem.
Cohomology and extensions
The main point here is that calculating extensions is hard, but calculating cohomology is easy(-er), because cohomology has a bunch of nice functorial properties. So, let me tell you how you can use cohomology to compute extensions.
In the following, let me fix any scheme $X$ and (unfortunately), for our purposes it's more convenient to work in the somewhat gnarly fpqc site (but don't worry, it will all be OK in the end).
Proof sketch: Note that $H^1(X_{\mathrm{fpqc}},F)=\varinjlim \check{H}^1(\{T_i\to X\}, F)$ where $\{T_i\to X\}$ runs over covers of $X$ in $X_{\mathrm{fpqc}}$, ordered by refinement, and $\check{H}^1$ denotes the first Cech cohomology group. Similarly, the isomorphism classes of locally split extensions of $$0\to F\to G\to \mathbb{Z}/p\mathbb{Z}\to 0$$ are given by $\varinjlim \mathrm{Ext}^1_{\{T_i\to X\}}(\mathbb{Z}/p\mathbb{Z},F)$ where $\mathrm{Ext}^1_{\{T_i\to X\}}(\mathbb{Z}/p\mathbb{Z},F)$ is the set of isomorphism classes of extensions of $\mathbb{Z}/p\mathbb{Z}$ by $F$ split over each $T_i$, a group under Baer sum. So, it suffices for me to tell you how to construct an isomorphism $$\check{H}^1(\{T_i\to X\},F)\xrightarrow{\sim}\mathrm{Ext}^1_{\{T_i\to X\}}(\mathbb{Z}/p\mathbb{Z},F),$$ functorial in refinement.
But, what is an element of $\check{H}^1(\{T_i\to X\}_{i\in I},F)$? By definition $$\check{H}^1(\{T_i\to X\}_{i\in I},F):=H^1\left(\prod_{i\in I}F(T_i)\xrightarrow{\partial_1} \prod_{(j_1,j_2)\in I^2}F(T_{j_1}\times_X T_{j_2})\xrightarrow{\partial_2}\prod_{(k_1,k_2,k_3)\in I^3}F(T_{k_1}\times X T_{k_2}\times T_{k_3})\to\cdots\right).$$ In other words, it's an element of $\ker(\partial_2)/\mathrm{im}(\partial_1)$.
On the other hand, what is an extension $$Q:\qquad0\to F\to G\to \mathbb{Z}/p\mathbb{Z}\to 0$$ split over each $T_i$? Well, consider the trivial extensions $$Q_i:\qquad 0\to F|_{T_i}\to F|_{T_i}\oplus \mathbb{Z}/p\mathbb{Z}\to \mathbb{Z}/p\mathbb{Z}$$ over each $T_i$. Then $Q$ is obtained gluing these $Q_i$ together. But, what is this gluing data? It's a set of isomorphisms $$(Q_{i_1})|_{T_{i_1}\times_X T_{i_2}}\cong (Q_{i_2})|_{T_{i_1}\times_X T_{i_2}} $$ which is compatible for a three-tuple $(k_1,k_2,k_3)$. But, what is an isomorphism $$(Q_{i_1})|_{T_{i_1}\times_X T_{i_2}}\cong (Q_{i_2})|_{T_{i_1}\times_X T_{i_2}} ?$$ A little thought shows it's nothing more than a homomorphism $\mathbb{Z}/p\mathbb{Z}\to F|_{T_1\times_X T_2}$ which, as $F$ is $p$-torsion, is just the same thing as an element of $F(T_1\times_X T_2)$. But what does it mean that it agrees on triple intersections? Precisely that it lies in $\ker(\partial_2)$. Finally, we only want isomorphism classes of extensions $$0\to F\to G\to \mathbb{Z}/p\mathbb{Z},$$ and so when does this glue to the trivial extension globally? Precisely when this element of $\mathrm{im}(\partial_1)$.$\blacksquare$
Claim 2: Let $X$ be a scheme. If $F$ is a $p$-torsion finite group $X$-scheme, then for any fpqc-locally split extension $$0\to F\to G\to \mathbb{Z}/p\mathbb{Z}\to 0$$ of abelian group sheaves, $G$ is representable (i.e. an abelian group $X$-scheme).
Proof: As affine $X$-schemes satisfy effective fpqc descent, it suffices to show that there exists an fpqc cover $\{T_i\to X\}$ such that each $G|_{T_i}$ is representable by an affine $T_i$-scheme. But, by assumption there exists such a cover $\{T_i\to X\}$ such that $G\cong F|_{T_i}\times \mathbb{Z}/p\mathbb{Z}$, which is affine. $\blacksquare$
Your actual question
So how is this relevant to you? Well:
Proof: As $\mathrm{Spec}(k^\mathrm{perf})\to \mathrm{Spec}(k)$ is an fpqc cover, it suffices to prove that the sequence splits when $k$ is perfect. But, observe that as $\mathbb{Z}/p\mathbb{Z}$ is etale and $\mu_{p}$ is connected, that this is precisely the connected-etale sequence for $G$, and so splits by [Milne, Proposition 11.3]. $\blacksquare$
(NB: pondering this proof will also show why the claim concerning $G_\mathrm{red}$ is true.)
So, combining Claim 1 and Claim 2 we see that to compute the extensions $$0\to F\to G\to \mathbb{Z}/p\mathbb{Z}\to0,$$ we just need to compute $H^1(\mathrm{Spec}(k)_{\mathrm{fpqc}},\mu_{p})$.
But, here is where the nice functorial properties of cohomology come into play. Namely, we have the Kummer sequence on $X_{\mathrm{fpqc}}$ for any scheme $X$: $$0\to \mu_p \to\mathbb{G}_m\xrightarrow{[p]}\mathbb{G}_m\to 0,$$ where $[p]$ denotes the multiplication-by-$p$ map. Thus, we get the exact sequence in cohomology $$0\to \mu_p(X)\to \mathbb{G}_m(X)\xrightarrow{[p]}\mathbb{G}_m(X)\to H^1(X_\mathrm{fpqc},\mu_p)\xrightarrow{[p]} H^1(X_{\mathrm{fpqc}},\mathbb{G}_m)\to H^1(X_{\mathrm{fpqc}},\mathbb{G}_m).$$ But, it turns out that $H^1(X_\mathrm{fpqc},\mathbb{G}_m)$ is easy to compute as $\mathbb{G}_m=\mathrm{Aut}(\mathcal{O}_X)$ -- it classifies line bundles, i.e. it's the Picard group. So, we deduce that there is an exact sequence $$0\to \mathcal{O}_X(X)^\times/(\mathcal{O}_X(X)^\times)^p\to H^1(X_\mathrm{fpqc},\mu_p)\to \mathrm{Pic}(X)[p]\to 0\qquad (1),$$ (where $A[p]$ denotes the $p$-torsion for the abelian group $A$).
Thus, when $X=\mathrm{Spec}(k)$ this reduces to the claim that $$k^\times/(k^\times)^p\xrightarrow{\sim}H^1(X_\mathrm{fpqc},\mu_p).$$ So again by Claim 1, Claim 2, and Claim 3 there is a natural bijection between the isomorphism classes of extensions $$0\to \mu_p\to G\to \mathbb{Z}/p\mathbb{Z}\to 0,$$ where $G$ is an abelian group $k$-scheme and $k^\times/(k^\times)^p$.
Moreover, as the proof of Claim 1 is constructive, you know exactly how to build these extensions. Namely, the isomorphism $(1)$ is seen to be functorial in $X$, we see that if $a$ is a class in $k^\times/(k^\times)^p$ then the corresponding extension $$0\to \mu_p\to G\to \mathbb{Z}/p\mathbb{Z}\to 0$$ is split as soon as $a$ becomes a $p^\text{th}$ power and so, in particular, is split over $k(\sqrt[p]{a})$. Note that for the cover $\mathrm{Spec}(k(\sqrt[p]{a}))\to \mathrm{Spec}(k)$ in $\mathrm{Spec}(k)_{\mathrm{fpqc}}$ we have that
$$\begin{aligned} \mathrm{Spec}(k(\sqrt[p]{a}))\times_{\mathrm{Spec}(k)}\mathrm{Spec}(k(\sqrt[p]{a})) &\cong\mathrm{Spec}(k(\sqrt[p]{a}\otimes_k k(\sqrt[p]{a}))\\ &\cong \mathrm{Spec}(k(\sqrt[p]{a})[T]/(T^p-a))\\ &\cong \mathrm{Spec}(k(\sqrt[p]{a})[T]/((T-\sqrt[p]{a})^p)\\ &\cong \mathrm{Spec}(k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p).\end{aligned}$$
So, $\mu_p(\mathrm{Spec}(k(\sqrt[p]{a}))\times_{\mathrm{Spec}(k)}\mathrm{Spec}(k(\sqrt[p]{a}))$ is order $p$ with generator $\tfrac{T}{\sqrt[p]{a}}$, and so the class corresponding to $a$ in $k^\times/(k^\times)^p$ is obtained by gluing $\mu_p\oplus \mathbb{Z}/p\mathbb{Z}$ to itself over $\mathrm{Spec}(k(\sqrt[p]{a}))\times_{\mathrm{Spec}(k)}\mathrm{Spec}(k(\sqrt[p]{a}))$ via the automorphism
$$\mu_p\oplus \mathbb{Z}/p\mathbb{Z}\xrightarrow{\sim}\mu_p\oplus \mathbb{Z}/p\mathbb{Z},\qquad (\zeta,m)\mapsto (\zeta(\tfrac{T}{\sqrt[p]{a}})^m,m).$$
Exercise
Your exercise is to explicitly write down what this $G$ looks like -- this is just a function of unraveling the definitions of gluing. The easiest way to do this, and how I suggest you go about it, is by trying to explicitly write down the Hopf algebra $\mathcal{O}_G(G)$ using the above explicit gluing data.
EDIT: Because this method is not really discussed about by Milne up until this point, let me give you a further nudge towards the solution of the exercise. I would strongly suggest you check my work, as I can't promise I didn't make a silly calculation error.
As $\pi\colon G\to\mathrm{Spec}(k)$ is affine, we know that we can write it as the relative spectrum $G=\underline{\mathrm{Spec}}(\mathscr{A})$, where $\mathscr{A}$ is the quasi-coherent $\mathcal{O}_{\mathrm{Spec}(k)}$-algebra $\pi_\ast\mathcal{O}_G$.
Remark: Of course this is a bit highfalutin here as $X=\mathrm{Spec}(k)$ is affine, but it shows you how to generalize these ideas to other $X$.
As $\mathscr{A}$ is a sheaf on $\mathrm{Spec}(k)_\mathrm{fpqc}$ (as follows from fpqc descent for quasi-coherent sheaves) we know that for the fpqc cover $U=\mathrm{Spec}(k(\sqrt[p]{a}))\to \mathrm{Spec}(k)=X$ we know that we have an equalizer diagram sequence
$$0\to \mathscr{A}(X)\to \mathscr{A}(U)\underset{p_2^\ast}{\overset{p_1^\ast}{\longrightarrow}}\mathscr{A}(U\times_X U),$$
where the maps $p_i^\ast\colon \mathscr{A}(U)\to \mathscr{A}(U\times_X U)$ for $i=1,2$ are the ones induced by the projection maps $p_i\colon U\times_X U\to U$. But, we've already calculate $U\times_X U$ above and, by definition:
$$\begin{aligned}\mathscr{A}(U) &=k(\sqrt[p]{a})[x]/(x^p-1)\otimes_{k(\sqrt[p]{a})} \prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})\\ &\cong \prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})[x]/(x^p-1),\\ &\\ \mathscr{A}(U\times_X U)&=k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p)[x]/(x^p-1)\otimes_{k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p)} \prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p)\\ &\cong \prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p)[x]/(x^p-1)\\ &=\prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})[T,x]/((\tfrac{T}{\sqrt[p]{a}}-1)^p,x^p-1) .\end{aligned}$$
It is convenient to relabel the $i^\text{th}$-component in the two above final products as having coordinate $x_i$ (instead of just $x$ which can be confusing). Then, one of the maps $p_1^\ast$ is the natural inclusion of $\mathscr{A}(U)$ into $\mathscr{A}(U\times_X U)$ via the natural inclusion of $k(\sqrt[p]{a})\to k(\sqrt[p]{a})[T]/((\tfrac{T}{\sqrt[p]{a}}-1)^p)$. The map $p_2^\ast$ is determined by the following rule:
$$(0,\ldots, 0,x_i,0,\ldots,0)\mapsto \left(0,\ldots,0,(\tfrac{T}{\sqrt[p]{a}})^i x_i,0,\ldots,0\right).$$
Thus, all in all, we see that as $k$-algebra
$$\mathcal{O}_G(G)=\mathscr{A}(X)=\left\{(f_i(x_i))\in\prod_{i\in\mathbb{Z}/p\mathbb{Z}}k(\sqrt[p]{a})[x_i]/(x_i^p-1): f_i(x_i)=f_i\left((\tfrac{T}{\sqrt[p]{a}})^i x_i\right)\in k(\sqrt[p]{a})[T,x]/((\tfrac{T}{\sqrt[p]{a}}-1)^p,x^p-1)\text{ for all }i\right\}.$$
The $k$-algebra structure is the obvious one. I leave it to you to write down the comultiplication (i.e. Hopf algebra structure), and to see if you can describe this Hopf $k$-algebra more concretely.
References
[Milne] Milne, J.S., 2017. Algebraic groups: the theory of group schemes of finite type over a field (Vol. 170). Cambridge University Press.