If we consider the ordering on $\mathbb{Q}$, then we obtain characterizations of the compact subsets of $\mathbb{Q}$ which give more information about these compact subsets than the homeomorphism type in Ville Salo's answer.

A linearly ordered set $X$ is said to be scattered if $X$ does not contain any order isomorphic copy of the rational numbers.

Let $\mathcal{A}_{\alpha}$ be the class of all totally ordered sets of the form
$\bigcup_{a\in A}X_{a}$ where

$A$ is either well-ordered or dual-well ordered,

if $a<b$ and $x\in X_{a},y\in X_{b}$, then $x<y$, and

either $X_{a}\in\bigcup_{\beta<\alpha}\mathcal{A}_{\beta}$ or $\lvert X_{a}\rvert\leq 1$.

Let $\mathcal{A}_{\infty}=\bigcup_{\alpha}\mathcal{A}_{\alpha}$.

Theorem: A linearly ordered set $X$ is scattered if and only if $X\in\mathcal{A}_{\alpha}$ for some ordinal $\alpha$.

Proof outline: The direction $\leftarrow$ is proven using a standard transfinite induction. For $\rightarrow$, suppose that $X\notin\mathcal{A}_{\alpha}$ for all ordinals $\alpha$. Then one can show that there is some $x\in X$ where
$\{y\in X\mid y<x\}\notin\mathcal{A}_{\infty}$ and
$\{y\in X\mid y>x\}\notin\mathcal{A}_{\infty}$. Therefore, by recursion, one can construct a set $X_{\gamma}$ along with an element $x_{\gamma}$ for each binary string $\gamma$ where we set $X_{\epsilon}=X$ and where for each binary string $X_{\gamma}$, there is an element $x_{\gamma}$ where if $X_{\gamma 0}=\{y\in X_{\gamma}\mid y<x\}$ and
$X_{\gamma 1}=\{y\in X_{\gamma}\mid y>x\}$, then $X_{\gamma 0}\notin\mathcal{A}_{\infty}$ and $X_{\gamma 1}\notin\mathcal{A}_{\infty}$. In this case,
the set $\{x_{\gamma}\mid \gamma\}$ is order isomorphic to $\mathbb{Q}$.

Q.E.D.

Proposition: A linearly ordered set $X$ is compact in the order topology if and only if $X$ is complete as a lattice.

Suppose that $A$ is a subset of a linearly ordered set $X$. Then an element $a\in A$ is said to be a gap point if there exists some $x\in X$ where either

$a<x<\{b\in A\mid b>a\}$ but where the set $\{b\in A\mid b>a\}$ has no minimal element or

$\{b\in A\mid b<a\}<x<a$ but where the set $\{b\in A\mid b<a\}$ has no maximal element.

Proposition: Suppose that $A$ is a subset of a linearly ordered set $X$. Then every set that is open in the order topology on $A$ is also open in the subspace topology.

Proposition: Suppose that $A$ is a subset of a linearly ordered set $X$. Then the following are equivalent:

the order topology on $A$ coincides with the subspace topology.

$A$ has no gap points.

if $R\subseteq A$ and $\bigvee^{A}R$ exists, then $\bigvee^{X}R$ exists and $\bigvee^{A}R=\bigvee^{X}R$, and if $R\subseteq A$ and $\bigwedge^{A}R$ exists, then $\bigwedge^{X}R$ exists and $\bigwedge^{A}R=\bigwedge^{X}R$.

Proposition: Suppose that $X$ is a set and $\mathcal{S}$, $\mathcal{T}$ are compact Hausdorff topologies on $X$ with $\mathcal{S}\subseteq\mathcal{T}$. Then $\mathcal{S}=\mathcal{T}$.

Proposition: Suppose that $A$ is a subset of a linearly ordered set $X$. Then the following are equivalent:

$A$ is a complete sublattice of $X$ in the sense that if $R\subseteq A$, then
$\bigvee^{X}R,\bigwedge^{X}R$ exist and $\bigvee^{X}R,\bigwedge^{X}R\in A$.

$A$ is compact in the subspace topology.

$A$ is compact in the order topology, and the subspace topology on $A$ is the same as the order topology on $A$.

Let $X$ be a linearly ordered set. For each ordinal $\alpha$, let $\mathcal{C}_{\alpha,X}$ be the collection of all subsets $A\subseteq X$ where either

there exists an ordinal $\delta$ and a continuous increasing function $f:\delta+1\rightarrow X$ where $f[\delta+1]\subseteq A$ and if $\gamma<\delta$, then
$A\cap[f(\gamma),f(\gamma+1)]\in\bigcap_{\beta<\alpha}\mathcal{C}_{\alpha,X}$ or
$\lvert A\cap[f(\gamma),f(\gamma+1)]\rvert=1$ and where $A\subseteq[f(0),f(\delta)]$, or

there exists an ordinal $\delta$ and a continuous decreasing function $f:\delta+1\rightarrow X$ where $f[\delta+1]\subseteq A$, and if $\gamma<\delta$, then $A\cap[f(\gamma+1),f(\gamma)]\in\bigcap_{\beta<\alpha}\mathcal{C}_{\alpha,X}$ or
$\lvert A\cap[f(\gamma+1),f(\gamma)]\rvert=1$ and where $A\subseteq[f(\delta),f(0)]$.

Let $\mathcal{C}_{\infty,X}=\bigcup_{\alpha}\mathcal{C}_{\alpha,X}.$

Proposition: A subset $A$ of a linearly ordered set $X$ is compact in the subspace topology and scattered if and only if $A\in\mathcal{C}_{\alpha,X}$ for some ordinal $\alpha$.

Proof:

$\leftarrow$ Observe that if $A\in\mathcal{C}_{\alpha,X}$ for some $A$, then $A\in\mathcal{A}_{\alpha}$, so $A$ is scattered. Furthermore, by transfinite induction, each $A\in\mathcal{C}_{\alpha,X}$ is a complete sublattice of $X$, so $A\in\mathcal{C}_{\alpha,X}$ is compact in the subspace topology.

$\rightarrow$ Suppose that $A\notin \mathcal{C}_{\infty,X}$. Then I claim that either $A$ is not compact in the subspace topology or $A$ has an isomorphic copy of the linear order $\mathbb{Q}$. Suppose that $A$ is compact in the subspace topology.

Then let $P=\{a\in A\mid\{b\in A\mid b\leq a\}\in\mathcal{C}_{\infty,X}\}$. Then $P$ has a largest element which we shall call $p$.

Let $Q=\{a\in A\mid\{b\in A\mid b\geq a\}\in\mathcal{C}_{\infty,X}\}$. Then $Q$ has a least element which we shall call $q$. If $q\leq p$, then we can conclude that $A\in\mathcal{C}_{\infty,X}$ which is a contradiction. We therefore know that $p<q$ and that $[p,q]\cap A\notin\bigcup_{\alpha}\mathcal{C}_{\alpha,X}$. In particular, if $x\in (p,q)\cap A$, then $(-\infty,x]\cap A\notin \mathcal{C}_{\infty,X}$ and $[x,\infty)\cap A\notin \mathcal{C}_{\infty,X}$.

Let $A_{\epsilon}=A$. We construct a system of elements $(x_{\gamma})_{\gamma\in\{0,1\}^{*}}$ in $A$ along with a system of subsets $(A_{\gamma})_{\gamma\in\{0,1\}^{*}}$ of $A$ recursively. For each binary string $\gamma$, let $x_{\gamma}\in A_{\gamma}$ be an element such that $[x_{\gamma},\infty)\cap A_{\gamma}\notin\mathcal{C}_{\infty,X}$ and $(-\infty,x_{\gamma}]\notin\mathcal{C}_{\infty,X}$. Then let
$A_{\gamma 0}=(-\infty,x_{\gamma}]$ and let $A_{\gamma 1}=[x_{\gamma},\infty)$. Then $(x_{\gamma})_{\gamma\in\{0,1\}^{*}}$ is a subset of $A$ order isomorphic to
$\mathbb{Q}$. Therefore, $A$ is not scattered.

Q.E.D.

Corollary: Let $X$ be a totally ordered set of cardinality less than the continuum. Then a subset $A\subseteq X$ is compact in the subspace topology if and only if $A\in\mathcal{C}_{\infty,X}$.

**The upper limit topology**

There is a simpler characterization of the compact subsets of $\mathbb{Q}$ where the subsets are given the subspace topology and $\mathbb{Q}$ is given the upper limit topology. Observe that since the upper limit topology on $\mathbb{Q}$ is homeomorphic to the order topology, the case when $\mathbb{Q}$ has the upper limit topology is not any different than the case with the order topology.

Recall that the upper limit topology on a totally ordered set $X$ is the topology where if $x$ is the least element of $X$, then $x$ is isolated, and where the local basis around $x$ consists of the intervals of the form $(v,x]$ where $v<x$.

Theorem: Every countable first countable regular space without any isolated points is homeomorphic to $\mathbb{Q}$ with the order topology.

Corollary: The set $\mathbb{Q}$ with the upper limit topology is homeomorphic to $\mathbb{Q}$ with the order topology.

Proposition: Let $X$ be a totally ordered set. Then $X$ is compact in the upper limit topology if and only if $X$ is well-ordered and has a greatest element.

Proposition: Let $X$ be a totally ordered set with the upper limit topology. Let $A$ be a subset of $X$, and give $A$ the subspace topology. Then $A$ is compact if and only if there is some ordinal $\alpha$, and a continuous function $f:\alpha+1\rightarrow X$ where if $\beta<\gamma\leq\alpha$, then $f(\beta)<f(\gamma)$.

internal property). $\endgroup$