A melted metal is like melted ice. The constituent molecules will flow freely, unbound or only loosely bound to one another - that is the definition of melting.
When cooled, and the liquid-solid transition temperature is reached, the molecules will again more tightly bond with one another. The solid will have the shape of the container that held the melted material. There is no metal that will automatically regain its original formed shape after being melted. However, there are some metal alloys that will return to original shape when heated (not melted) if they had previously been mechanically deformed (not melted). NiTinol - (nickel titanium alloy) is such a "memory metal".
The internal structure of a metal alloy may be different after melting and resolidifying, depending on what metal you are working with. Metals have crystaline structures. The shape and bonds of the metallic crystal depend to some extent upon the rate at which the metal is allowed to cool. and the environment in which the metal cools. The shape of the crystaline bonds determines such things as tensile strength, appearance, and brittleness. That is why a quenched steel blade (tempered) will hold an edge better than the unquenched blade - the quenched (tempered) metal is harder (more brittle). The act of quenching changes the shape of the metallic crystaline structure. Likewise, a metal can be surface treated for varying degrees of hardness by allowing it to cool in a nitrogen gas environment, or other gaseous or liquid environment.
There is much information available on the Internet if you use a search engine such as Google.