Consider the following theorem:
Let $f:[a,b]\to \mathbb R$ be a bounded function continuous at all but finitely many points,then $f$ is Riemann integrable.
The proof I found in textbooks is not very intuitive.I am looking for a visually intuitive proof of this theorem.Can someone tell me the basic idea behind the proof.I think the idea is to pin down the discontinuity points by small neighbourhoods and consider partitions avoiding those points.But I want a more clear idea.

The most basic intuition is "it's Riemann integrable because it is a finite sum of Riemann integrable functions". Just define a function on each interval of continuity, sum them up. So now it suffices to check that a bounded function continuous on $(c,d) \subset [a,b]$ and zero outside $[c,d]$ is Riemann integrable on $[a,b]$, and that a finite sum of Riemann integrable functions is Riemann integrable.
You can actually carry out the proof in this way, but first you have to make a detour into proving that Riemann integration is equivalent to Darboux integration. This lets us forget about arbitrary partitions and arbitrary taggings, instead we can just pick one sequence of partitions and compare upper sums and lower sums.
Then we need one more lemma: if $P$ is a partition and $Q$ is a refinement of $P$ then $U(f,Q)-L(f,Q) \leq U(f,P)-L(f,P)$. Armed with both of these, we can do the following very simple argument: given partitions $P_k$ with $U(f_k,P_k)-L(f_k,P_k)<\epsilon/n$, take $P$ to be the union of the $P_k$ and then have $U(\sum_{k=1}^n f_k,P)-L(\sum_{k=1}^n f_k,P)<\epsilon$.
If you work from the definition instead, you still really want to prove the Darboux integration equivalence. After that, you can follow the approach you described, by choosing to have all points of the form $x \pm \epsilon/(8nM)$ (clamped to be in $[a,b]$ if necessary) in the partition. Here $n$ is the number of discontinuities, $M$ is a bound on $|f|$, and $x$ is the location of a particular discontinuity.
By doing that, each discontinuity can only contribute a deviation between the upper and lower sums of $\epsilon/(2n)$ and so all of them together can only contribute a deviation of $\epsilon/2$. After that we are free to add more points to the partition until the continuous parts have a total deviation less than $\epsilon/2$ and then we're done.