[proofplan]
We count the same finite set in two different ways. The set being counted is the flag set $I$, whose elements are incident point-block pairs. Grouping flags by their point coordinate gives $\sum_{x \in X} r_x$, while grouping the same flags by their block coordinate gives $\sum_{B \in \mathcal{B}} |B|$. Since both expressions equal $|I|$, they are equal to each other.
[/proofplan]
[step:Count the flags by their point coordinate]
Define the flag set $F$ by
\begin{align*}
F := I \subset X \times \mathcal{B}.
\end{align*}
Since $X$ and $\mathcal{B}$ are finite, the Cartesian product $X \times \mathcal{B}$ is finite, and hence $F$ is finite.
For each $x \in X$, define the point fibre $F_x$ by
\begin{align*}
F_x := \{(x', B) \in F : x' = x\}.
\end{align*}
The sets $(F_x)_{x \in X}$ are pairwise disjoint, and their union is $F$, because every flag $(x', B) \in F$ has a unique first coordinate $x' \in X$. Therefore
\begin{align*}
|F| = \sum_{x \in X} |F_x|.
\end{align*}
For fixed $x \in X$, define the map $\phi_x: F_x \to \{B \in \mathcal{B} : (x, B) \in I\}$ by sending each flag $(x, B) \in F_x$ to its block coordinate $B$. This map is a bijection, with inverse $B \mapsto (x, B)$. Hence $|F_x| = r_x$ for every $x \in X$, and so
\begin{align*}
|F| = \sum_{x \in X} r_x.
\end{align*}
[guided]
The flag set is the set of all incidences. We define
\begin{align*}
F := I \subset X \times \mathcal{B}.
\end{align*}
Because $X$ and $\mathcal{B}$ are finite, the product $X \times \mathcal{B}$ is finite, and every subset of a finite set is finite. Thus $F$ is finite and can be counted by partitioning it into fibres.
We first group flags according to their point coordinate. For each $x \in X$, define
\begin{align*}
F_x := \{(x', B) \in F : x' = x\}.
\end{align*}
These subsets are pairwise disjoint: if $x_1 \ne x_2$, no ordered pair can have first coordinate both $x_1$ and $x_2$. Their union is all of $F$, because every flag $(x', B) \in F$ has exactly one first coordinate, namely $x'$. Therefore finite additivity of cardinality over a disjoint finite union gives
\begin{align*}
|F| = \sum_{x \in X} |F_x|.
\end{align*}
Now we identify the size of each fibre. For fixed $x \in X$, define the map $\phi_x: F_x \to \{B \in \mathcal{B} : (x, B) \in I\}$ by sending each flag $(x, B) \in F_x$ to its block coordinate $B$.
This map is well-defined because $(x, B) \in F = I$ exactly means that $B$ is incident with $x$. It is injective because two ordered pairs in $F_x$ with the same second coordinate are the same pair. It is surjective because every block $B \in \mathcal{B}$ with $(x, B) \in I$ gives the flag $(x, B) \in F_x$. Hence $\phi_x$ is a bijection.
By the definition of $r_x$,
\begin{align*}
r_x = |\{B \in \mathcal{B} : (x, B) \in I\}|.
\end{align*}
The bijection above gives $|F_x| = r_x$. Substituting this into the fibre count yields
\begin{align*}
|F| = \sum_{x \in X} r_x.
\end{align*}
[/guided]
[/step]
[step:Count the same flags by their block coordinate]
For each $B \in \mathcal{B}$, define the block fibre $F_B$ by
\begin{align*}
F_B := \{(x, B') \in F : B' = B\}.
\end{align*}
The sets $(F_B)_{B \in \mathcal{B}}$ are pairwise disjoint, and their union is $F$, because every flag $(x, B') \in F$ has a unique second coordinate $B' \in \mathcal{B}$. Therefore
\begin{align*}
|F| = \sum_{B \in \mathcal{B}} |F_B|.
\end{align*}
For fixed $B \in \mathcal{B}$, define the map $\psi_B: F_B \to \{x \in X : (x, B) \in I\}$ by sending each flag $(x, B) \in F_B$ to its point coordinate $x$. This map is a bijection, with inverse $x \mapsto (x, B)$. Hence $|F_B| = |B|$ for every $B \in \mathcal{B}$, and so
\begin{align*}
|F| = \sum_{B \in \mathcal{B}} |B|.
\end{align*}
[/step]
[step:Equate the two counts of the flag set]
The first count gives
\begin{align*}
|F| = \sum_{x \in X} r_x,
\end{align*}
and the second count gives
\begin{align*}
|F| = \sum_{B \in \mathcal{B}} |B|.
\end{align*}
Both right-hand sides are equal to the same finite cardinality $|F|$. Therefore
\begin{align*}
\sum_{x \in X} r_x = \sum_{B \in \mathcal{B}} |B|.
\end{align*}
This is the desired identity.
[/step]