Keeping cardinal tetras;
Cardinal tetras are not the hardiest of fish as they can be very sensitive to things nitrites and ammonia (and excessive nitrates) and can be killed off easily by such things, so they are not recommend fish for a cycling or newly cycled tank. Many people recommend them only for tanks that have been set up for 6months or longer as at this stage in the tanks maturity it is considered fully established and not likely to suffer water quality problems as long as the tank went through a straightforward cycle at the start with no futher complications.
You can put cardinal tetras in tanks less than 6months mature, but the younger the tank set up, the more likely it is to experience water quality problems/complications. A lot also depends on how the tank is cycled- tanks which are fishless cycled tend to establish themselves quicker than tanks which are cycled with fish, for more info on cycling tanks see below link;
http/www.fishforums.net/index.php?showtopic=10099
(There are many other articles on things like cycling tanks, water quality etc if you do a search or check out the pinned articles on the forum etc too)
Cardinal tetras are shoaling fish and do best in a group of at least 6, however in tanks 50gallons or above i would recommend at least 8 -10 cardinals- for tanks 140gallons or more, i would recommend at least 15-20 cardinals minimum. Shoaling is a defensive sort of behavior, fish like cardinals shoal when they feel threatend or stressed or are moving as a group across long distances- thus it is normal for cardinal tetras to not shoal all the time in the same group if they feel happy in their environment. When shoaling fish are kept in groups too small for their particular species and environment, they will feel stressed (even if there is no apparent threat to them, it is instinctive for them to not be always confined to small numbers) and they may fade in colour and/or display abnormal behavior like agression amoungst each other etc.
Ultimately, the more cardinals you have the more secure they will feel in the tank, i would go for as many as you feel comfortable with having as long as you do not overstock the tank and have at least 6 of them.
The tank should have at least one large open space in it to allow the cardinals to shoal freely if they want to, but it is also good to include some planting in the habitat to add some cover and help them feel more at home. Cardinal tetras will not make use of things like caves, so these are not nesarsary. Type of substrate is not really important either way too as long as it there is some sort of substrate in the tank and it is kept very clean.
Fish like cardinal tetras are insectivores/omnivores, a varied diet is one of the keys to good health and a long life in cardinal tetras and any other fish. They will accept fish flakes, but personally i would advise trying to vary their diet instead of feeding them solely of standard fish flakes- foods like bloodworms, daphinia, artemecia, krill etc will all be readily accepted- TetraPro vegetable flakes also make a good food to help get some veg into the tetras diet too, there are also frozen cubes of fish vegetables like cooked and chopped up spinache too which can be fed to the fish. I would not recommend feeding fish tubifex though, as it has been known to often come from areas contaminated with raw sewage and live tubifex worms can pass on internal parasites to fish.
When feeding foods to fish, frozen or live foods are more nutritious and easier to digest for fish than dried ones. The higher the ash content of fish foods, the poorer the quality they tend to be.
As to how many fish you can add at once to a tank, it depends on;
a. The size/gallons/litres of the tank.
b. How long it has been running and whether it is cycling or not.
c. How powerful the filtration is (is it barely adequately filtered, over filtered etc- do you have a filter that can barely do the gallons of your tank, or more than easily filter them etc).
d. How stocked the tank currently (what fish do you have, how many, what sizes etc).
If you fill out this info, i can advise you better on stocking your tank with cardinal tetras.
Cardinal tetras are primarily peaceful fish and thrive best in a tank with a stocking of fish who are not overly active or agressive/territorial- i would avoid mixing them with very large fish too which occupy the same areas of the tank as they do. Water quality must be kept very clean with once weekly 30-60% water changes with dechlorinator and substrate cleaning sessions every 1-2weeks (depending on the tank stocking and type of substrate etc).
Edit: oh i forgot to add, that a soft acidic water is preferred most by these fish as they come from the amazon, however as long as the ph is not very alkeline in the tank, then the cardinal tetras should be able to adjust/acclimatise to it fine. I would not advise changing the ph unless it is rather alkeline or you are taking on a project like breeding them, as changing ph in tanks often causes it to fluctuate a lot, which can be very stressful for fish (particularly for sensitive fish like cardinal tetras).
I would recommend at least a 12gallon or 20inch long tank minimum for keeping these fish
. When in the tank, they will primarily occupy the middle to bottom section of the tank.