Why is the probability of getting it back and putting it back the same every time?

(1), the probability of the ith time is M/N,

I won't explain this, it's very simple.

(2) Don't put it back,

Consider arranging n products in a row,

Then all possible outcomes are A(N, n),

Among them, the result of defect at the ith time (i.e. the ith position) is as follows.

C(M, 1) A (n- 1,n- 1),

So the probability that the ith time (i.e. the ith position) is defective is

C(M, 1) A(N- 1,n- 1)/A(N,n)=M/N

The second case has a conclusion,

It's called "the lottery has nothing to do with signing the contract"