Detector Rail

Detector Rails are like pressure plates but are a type of rail, allowing minecarts to move over them.

When any kind of minecart is on top of the Detector Rail, it will generate a redstone signal. The signal will be transmitted to blocks that are adjacent to the detector (including Powered Rail) and redstone placed under the rail, meaning it behaves exactly like a wooden pressure plate.

Crafting
Detector rails are crafted as normal rails, but with a pressure plate instead of sticks, and the addition of redstone.

Uses
Detector rails can be used for many things. One train station-like feature could be activating a note block to indicate that a minecart is approaching.

Detector rails can be used with a memory cell to power powered rails for long tracks.

Additionally, they can be used to create a one-way gate to a Powered Rail, with any carts coming the other way slowing down if not stopping completely.

They also can be used to activate arrow shooters to create a minecart-friendly mob trap.

A trap based on the land mine trap can be built with powered rails as a stand in for a regular pressure plate, then placing it in a rail system to kill the occupants of minecarts. If water is beneath the TNT the explosion usually won't destroy the pressure detector rail and can't destroy the mine cart. Because the mine cart absorbs the blast, a detector rail trap won't usually be lethal to anyone outside the cart or a few blocks away. There is a chance that the minecart will bump the TNT and prevent it from falling straight down and not touch the water and therefore destroy blocks when it explodes. It is also possible for a very fast moving mine-cart to skip over the pit the TNT makes as it falls, thereby evading danger.

As a defense mechanism in multi player or for your own challenge, you can make a rectangle using powered rails, regular rails, and detector rail. you make a box around it with glass except the floor. at every detector rail have a red-stone rail leading to a dispenser filled with arrows. When you begin the movement of the mine carts they'll pass over the detector firing the arrows in a constant pattern until you run out of ammo. It is also good for speed killing by filling a hole with mobs and slaughtering the mobs inside. You can get a lot of resources this way.

Trivia

 * When the detector rail was first added to the game it could not be placed next to any rail without the game crashing due to a bug.
 * Occasionally placing a detector rail will power other rails without needing a minecart on it.
 * If a detector rail is placed on a slope and the next rail has the opposite slope, the detector will only generate signals for occupied carts (like a stone pressure plate). This bug can be used to detect and redirect empty carts. Screenshot (please embed this here)