I know of the test to check if an egg is still fresh:
However, what techniques are there for keeping eggs fresh for longer?
If you can purchase pasteurized-shell eggs, they will last the longest. I've kept pasteurized-shell eggs refrigerated for over three months with no loss in freshness.
Recent research has shown that the European idea that washing harms the cuticle, promoting entry of bacteria through the shell is false, so it's perfectly safe to keep unrefrigerated eggs cool, but unrefrigerated.
If you've purchased refrigerated eggs, keep them refrigerated. Condensation can form on chilled eggs coming up to room temperature that will promote bacterial growth.
In a cool place - but not in the refrigerator as it causes them to dry out inside as the shells are permeable, letting out moisture.
The old classic method of preserving shell eggs for long periods without refrigeration was to dip the eggs in water glass (a solution of sodium silicate in water). This would make the shells airtight, preventing oxidation and (most) bacterial growth, and allow shell eggs to keep for several weeks at room temperature. Combined with refrigeration below 40 F after the water glass sets, this ought to keep eggs in Grade A condition for at least three months by preventing the drying that otherwise takes place in a refrigerator.
BTW, this is the same effect as coating them with mineral oil, only the water glass can't soak through the shell and won't flavor the egg if a piece of shell gets into the contents when you break the shell. Water glass is also a bit less permeable, so should last longer than oil coating.
Try to always keep the temperature of the surrounding same and If you've put in refrigerator don't take out unless you're about to use it. More than half or an hour out of good refrigeration and you've spoiled the egg even if it was a fresh egg.
In addition to whatever other method you find, buy eggs straight from the farmer (at his farm or the market). It's cheaper, better for the local economy, and they are fresh.
The store bought eggs may be many weeks old already, and they have ridiculous regulations (varies by region, may also affect your farmer direct ones), like using soap or hot water to wash them, which (1) removes protective natural coatings and (2) due to hot and then cold temperature sucks dirt in the pores of the shell.
Ask the farmer how he washes them. (and the best answer may be "not at all", so don't reject that answer... the best is to wash them before you use them rather than before buying)
Coating eggs in mineral oil can also prevent the air/moisture exchange that David mentioned, but with out the exposure to the air inside a container.
Note: Probably should have mentioned this, only use food grade mineral oil!
You could make some hard-boiled eggs, which last longer than regular ones. This depends on whether you enjoy your eggs hard-boiled or not though.
Turning eggs upside down once a week keeps eggs staying fresh much longer - at least two months (by which time I'm all out of eggs). In order to remember whether I've turned them, I put a mark on the top of the eggs when I buy them and turn them each weekend.
I have only tried this with refrigerated eggs but I don't see any reason why it wouldn't work with eggs at room temperature either...