In Team Fortress 2 as the spy, when you change to your Disguise Kit, you are presented with an option to change the team you are disguised as. Why would you ever want to disguise yourself as someone from your own team? Doesn't that defeat the purpose of the disguise kit?
Friendly disguises are mainly used to hide from the enemy that there are Spies in your team, as well as to fool an enemy into thinking your team employs a certain class when in reality it does not. There's little more utility for friendly disguises than that, but they're very handy during setup time when the enemy can see you through the setup gates, as well as when you're among your teammates. There's more of this in the community Spy strategy wiki article.
Remember that since you're disguising as your own team, the opposing team will see you as an enemy player (whichever class you're disguised as) and act accordingly, and enemy Sentry Guns will target you as well. When you're about to infiltrate into enemy lines, use your cloak and/or switch to an enemy disguise.
Any of the cloaking devices works well; in fact, if you use the Dead Ringer with a friendly disguise, you will drop a fake corpse of the class you're disguised as. If you were disguised as an enemy, you would drop a fake Spy corpse, which often sends a stronger signal to opposing players of a possible DR Spy.
The short answer is: disguising as your own team gets you killed less in many situations and helps you get behind enemy lines where the spy is most effective.
Using friendly disguises help you get through your own friendly territory more easily. The following will explain how friendly disguise helps getting through friendly territory.
Equipped with standard cloak traveling through friendly territory
Let's say you spawn and immediately change classes to the enemy class at your spawn. Any enemy you encounter will see you running towards their base and immediately attack you because they know you are spy... they will very likely kill you or force you to circle back to get health... causing you to lose a lot of time... making you NOT get behind enemy time and making you less effective.
Things to understand from this example:
So now you know why it is bad to be disguised as enemy team in friendly territory. One alternative is "oh then i will use cloak to run through friendly territory and thus not draw attention to myself". Well cloak doesn't last long enough to stay cloaked from spawn to "behind enemy lines where there is a safe decloak spot". So you will end up decloaking somewhere in the middle and then likely get killed because you can't use your cloak... and being dead isn't really being a good spy.
Now the problem becomes if you can't use cloak the whole way, what do you? Well you can run as an undisguised spy while in enemy territory. Any enemy you encounter will immediately attack you because spies are easy kills and they are high priority. Suddenly you are a dead spy AGAIN.
If you can't be disguised as enemy, use cloak, OR even stay an undisguised spy... then again the question is: what do you do?
If you disguise as a your own team's pyro or demoman your speed is 100% and the enemy won't immediately prioritize you as the #1 target. Now you can more easily get through your own friendly territory (as compared to all the other scenarios I outlined).
Once you are near, at, or behind the enemy line
For those of you not familiar with using friendly disguise (which is presumably why you are reading), you will obviously NEED to change from friendly team disguise to enemy team disguise when you are near or past the enemy line.
The reason is obvious but I will explain anyway: when you are near or past enemy lines the situation has changed 180 degrees. Suddenly being disguised as your friendly team makes you the #1 priority target... and being disguised as enemy team makes you less of a target. Hence being disguised as enemy team is good again.
Getting through friendly territory is not always a walk in the park. Using friendly disguise is one of the best ways to get through friendly territory and not get killed/hurt... which means you are spending more time behind enemy lines and being more effective!
 they don't know 100% but instead the chance of you being a spy is very high
 spies are high priority because a good spy once behind enemy lines can cause long periods of their entire defense being very weak
Generally used just for the heck of it, to trick a scout to avoid a soldier sometimes (I do anyways). Otherwise if I know the other team has many spies, I will disguise as my own team as a pyro to deter them.
As others have said, it's all about misdirection. One other niche application, when using the Dead Ringer, is to trick enemy demomen into detonating their stickybombs. This can help your team-mates push through congested chokepoints, or if your team's spawn exit is being camped.
Disguising your self as a enemy team is one of the best ways to use the dead ringer.
Disguise your self as a same team pyro, run at them like any normal pyro.
Now to make it look more believable you do want to get hit more then once or it will be obvious that you are a dead ringer spy. Take about 2 hits then activate dead ringer, this will make them think they just killed a (w + mouse 1) pyro easily.
You can now slip right past them and disguise as an enemy unit now.
This works much better then disguising as an enemy and trying to sneak past them, as you are running the wrong way they will shoot you and notice that you are a dead ringer spy and then be on the lookout for you. The above method prevents this.
Basically everyone on the opposing team is less likely to spy check or be prepared for a spy assault if the enemy doesn't see a spy present.
Out of sight, out of mind.
I usually start as a scout or some other aggressive class, that way it isn't a surprise to the enemy when I easily exploded out of the starting gate (or so they think).
It's a good way to start a play-dead run. After the first play dead you can often get behind enemy lines by running from ammo to ammo, if possible. And if no one sees a spy up until that point, they won't be watching their backs.