[doubt] how do analog innput pins exactly work?

Hi, i'm a beginner with arduino (i bought a Mega 2560) and i'm doing some tests and simple codes just to learn how to program (where i'm a beginner too).
messing around analogread i had a doubt, what if i connect the +5V line directly (i mean, by an ideal zero-resistance wire) to an input pin and then i read it? will it be shorted? where is the current drained out, to the ground trought the AtMega? if so what resistance will the AtMega have? initially i thought i must calculate it using R = V/i, with V=5v and i = 40 mA (the limit values for the Arduino), but i'm not sure.
Since i will connect (for a future project) some sort of a vacuum sensor to the Arduino, i must know what is the maximum current i can plug in the analog input pin of the arduino. or if there is a sistem to keep the current down to 40mA without affecting the voltage measured by the Arduino.
i know they are quite a lot of doubts but, man, i don't want to set my new favorite thing on fire!
thanks for your help (and your patience for my horrible english) and by the way, arduino is fantastic!!!!!!

First of all input pins, analog or digital, don't draw any appreciable current at any voltage from 0 to +5vdc, they have very high input impedance. What current that does flow into a analog input pin is just what the internal multiplexer sample and hold capacitor requires to charge to the source voltage being presented to the input pin. The need to charge this capacitor in a timely manner is why the AVR recommends a source driving impedance of 10k ohms or less.

The 40ma current limit you talk of is only applicale to OUTPUT pins and one really should limit them to 20-30ma max rather then the absolute 40ma maximum limit stated by AVR.

So input pins and output pins are very different animals so you first need to understand that concept as you design interfaces to a arduino board.

Lefty

woah, fast and precise, thank so much!
so i must consider the AtMega as an ideal voltmeter with infinite resistance (with reason, of course, i'm not going to attack a car battery to it), but with at least 0.5 mA current (5v/10kohms) to make the capacitor to charge fast enough, right? but is the capacitor able to discharge trought the AtMega between a reading and another, or it will discharge "backwards" trought the input pin and so i need a pulldown resistor?

but is the capacitor able to discharge trought the AtMega between a reading and another, or it will discharge "backwards" trought the input pin and so i need a pulldown resistor?

No need of a pulldown resistor. If the present voltage of the sample cap is higher then the source voltage then the current will flow out from the cap to the source voltage and equilize to the new source voltage on the next sample/hold/read operation.

Lefty

teddy:
so i must consider the AtMega as an ideal voltmeter with infinite resistance (with reason, of course, i'm not going to attack a car battery to it),

The only concern with a car battery is that it is 12V while the maximum input of Arduino IO pins is around 5V (depends on what voltage VCC is at). The current capacity of the source (in this case a car battery) is irrelevant. The Arduino is not an infinite resistance, it is a very high resistance.