The story is a bit more involved. There are various descriptions but the fact that they are equivalent is usually a deep theorem. In any case there is sheaf-theoretic approach pioneered by Kashiwara and Schapira (see their monograph Sheaves on manifolds) This is more difficult to explain within a limited since it it involves a rather heavy sheaf-theoretic machinery
In all cases one assigns an Euler characteristic to sets in a category of constructible spaces. I will not give here a definition of a constructible or tame category. I refer for a definition and many examples in Sec. 9.3.1 of this book. The simplest category of constructible sets(spaces) is the category of semi-algebraic sets and maps. Denote by $\newcommand{\SA}{\boldsymbol{S}\boldsymbol{A}}$ $\SA$$\newcommand{\SA}{\boldsymbol{S}\boldsymbol{A}}\SA$ the collection of all semialgebraic sets. A subset of an Euclidean space is semialgebraic if it is the union of sets defined by systems of polynomial inequalities. (Anything that you can visualize of a computer screen is semialgebraic.) Another category of sets for which this works is the category of subanalytic sets asas defined by Hironaka.
One important property of such sets is their triangulability. I'll state it vaguely. For every semi-algebraic set $X$ there exists an affine $N$-dimensional simplex $\Delta_N$ and a subset $K_*\subset \DElta_N$$$K_*\subset \Delta_N$ with the following properties.
- $K_*$ is a union of open faces of $K$.
- The set $K_*$ is semi-algebraically homeomorphic to $X$.
You should think of $K_*$ as defining a triangulation of $X$. Take for example the set $[0,1)$. It has a triangulation consisting of two open cells: $\{0\}$ and $(0,1)$. $\newcommand{\bZ}{\mathbb{Z}}$
The constructible EulerEuler characteristic is the function
$$ \chi_*: \SA\to \bZ, $$ uniquely determined byby the following requirements
- $$\chi_*(X\cup Y)=\chi(X)+\chi(Y)-\chi(X\cap Y),\;\;\forall X,Y\in \SA.$$
- $$\chi(\mathbb{R}^n)=(-1)^n$$.
- $\chi(X)=\chi(Y)$ if $X$ and $Y$ are semi-algebraically homeomorphic.
The fact that such a thing exists is not obvious and not trivial and I refer to the references in the book I mentioned above. Observe that if $X$ is compact then $\chi_*(X)$ is the usual topological Euler characteristic. Also, $\chi_*(\mathbb{R}^n)$ is the Euler characteristic of the cohomology of $\mathbb{R}^n$ with compact coefficients or, dually, the Euler characteristic of the Borel-Moore homology of $\newcommand{\bR}{\mathbb{R}}$ $\bR^n$.
For example if $X=[0,1)$ then $$ \chi_*(X)=\chi*(\{0\})+\chi_*(\;(0,1)\;)=1-1=0. $$
If $X$ is the unit disk in the plane, then $\chi_*(X)=1$. However, if $X$ is the disk with the center removed, then $\chi_*(X)=0$.
Denote by $\newcommand{\bsI}{\boldsymbol{I}}$ by $\bsI_A$ the indicator function of a set.
Denote by $\mathscr{C}(\bR^n)$ $\newcommand{\eC}{\mathscr{C}}$ the Abelian group generated by indicators of semialgebraic subsets of $\bR^n$. Equivalently $\eC(\bR^n)$ consists of * constructible functions*, i.e., functions $f:\bR^n\to\bZ$ with finite range such that $f^{-1}(k)$ is a semialgebraic subsetof $\bR^n$, $\forall k\in\bZ$. We have natural inclusions $$\eC(\bR^n)\subset \eC(\bR^{n+1}),$$ and we set $$ \eC=\bigcup_{n\geq 1}\eC(\bR^n). $$ The so called Groemer's Extension Theorem shows that there exists a unique morphism of groups
$$L:\mathscr{C}\to \bZ $$
such that $L(\bsI_X)=\chi_*(X)$, $\forall X\in \SA$. The morphism is the so called integration with respect to the Euler characteristic. For an informal introduction to this topic and some surprising applications I refer to this old seminar presentation of mine and the references therein.