If you feel behind your top teeth with your tongue, you can find a little shelf—a little flat bit of your mouth right behind your teeth. Behind that, your mouth suddenly rises up to make the 'roof' of your mouth.
That shelf is called your alveolar ridge. In English, we usually we make the sound /n/ on the alveolar ridge. In many languages people make an /n/ on the back of their top teeth, but in English we usually make it on that ridge.
However, in English we do make the sound /ð/—the sound in the word 'the'—on the back of our top teeth1.
This gives us a bit of a problem when we need to say things like in the world. The reason is that our tongue needs to be on the ridge to make the /n/ for the word in. But straight away it needs to be on the back of our teeth to make the /ð/ for the word the. Our tongue can't be in two places at the same time. And we can't stop speaking in the middle of a sentence just so we can move our tongue from one position to another.
So what do we do? Well, usually we just change the position that we make the /n/ sound. We make it on the back of our top teeth instead of on the alveolar ridge. We can write this /n/ with a little tooth symbol to show that it is being made on the teeth: n̪. Nearly all native speakers of English do this without thinking about it. We call this type of /n/ a dental /n/ (think of the word dentist).
So, if we make our n̪ on our teeth, we are making it in exactly the same position that we make our /ð/ in. We can move smoothly from the word in to the word the.
A lot of the time this is all we do. We make a dental /n/ and then a /ð/. However, when we aren't speaking slowly, we very often also get assimilation of the /ð/-sound—this is just a technical way of saying that the /ð/ sound changes and becomes similar to a sound that is next to it. When we get /nð/ together the /ð/ often changes into a nasal sound. We still make it in the same place, but there is no friction when we make the sound. This means that the /ð/ changes into an n̪!
So now we have two dental /n/'s together. One at the end of the word in and another at the beginning of the word the. This type of assimilation can happen any time we have /n/ followed by /ð/.
So if you are listening to a native speaker say on the table, they are very likely to say:
This can sound a little bit similar to on a table. But not the same though. There is a clear dental /n/ at the beginning of the word the. Notice that this has to be a dental /n/. If we just use a normal /n/ on the alveolar ridge, it won't sound good.
Notice that when the word the occurs before a vowel sound, it has a different vowel, the vowel /i/. So we are likely to pronounce in the end as:
So, in the end, it seems that the word the can sound a bit like the word a—sometimes.
Notes:
1. American phoneticians and phonologists call [ð] an interdental sound. Hoever, this is just tradition. The [ð] sound is still made behind the top teeth in normal speech for American English speakers, not between the upper and lower teeth!
2. I have used British English transcription here, as used by John Wells in the LPD.